分类 文章 下的文章

Visual Studio Code官网链接

https://code.visualstudio.com/

v1.71.0x64位镜像下载地址

https://vscode.cdn.azure.cn/stable/784b0177c56c607789f9638da7b6bf3230d47a8c/VSCodeUserSetup-x64-1.71.0.exe

更改官方下载地址为镜像下载地址

默认地址

https://az764295.vo.msecnd.net/stable/784b0177c56c607789f9638da7b6bf3230d47a8c/VSCodeUserSetup-x64-1.71.0.exe

需要将默认下载地址中的 az764295.vo.msecnd.net 更改为 vscode.cdn.azure.cn 即可快速下载

https://vscode.cdn.azure.cn/stable/784b0177c56c607789f9638da7b6bf3230d47a8c/VSCodeUserSetup-x64-1.71.0.exe

官网下载

https://nodejs.org/en/下载最新版或者稳定版的NodeJS

https://nodejs.org/dist/下载历史版本的NodeJS

安装

default默认安装或custom自定义安装,此处略

换源

前提是NodeJS已经安装完成,包括配置好了路径

//查询 npm 镜像
npm config get registry
//设置 npm 镜像,此处设置为淘宝的 npm 镜像
npm config set registry https://registry.npm.taobao.org/

模块安装路径

NodeJS使用全局安装模块是会安装到C:\Users\用户名\AppData\Roaming\npm\目录下,如需更换,执行下列操作

1.在更换的目录下,新建两个文件夹 node_cachenode_global ,并执行下列命令

npm config set prefix "D:\xxxx\xxxx\node_global"
npm config set cache "D:\xxxx\xxxx\node_cache"

2.设置环境变量

新建变量 NODE_PATH , 值为 D:\xxxx\xxxx\node_global

在系统或用户变量中的 Path添加 D:\xxxx\xxxx\node_global

3.删除原先的 Path变量

Path中删除 C:\User\xxxx\AppData\Roaming\npm

安装Apache2.4与php7.4

将Apache2.4的安装目录中的bin目录添加至环境变量

安装apache服务

通过命令行httpd安装Apache服务,将Apache服务添加到系统服务

httpd -k install -n "Apache2.4"

安装成功后出现 The 'Apache2.4' service is successfully installed.

启动apache服务

httpd -k start
或者
net start Apache2.4

也可以通过bin目录下的ApacheMonitor.exe进行可视化操作,开启apache服务。

Apache中添加PHP

打开Apache/conf/httpd.conf文件,并添加以下配置

LoadModule php7_module "{{可以填入绝对路径}}Apache/php-7.4.24/php7apache2_4.dll"
AddType application/x-httpd-php  .php
#configure the path to php.ini
PHPIniDir "{{php.ini所在目录的绝对路径}}"

Apache修改站点目录,开启虚拟主机配置及目录权限

Options Indexes FollowSymLinks 目录下没有index.html或index.php会显示目录文件

Options FollowSymLinks 禁止显示目录文件

DocumentRoot "${SRVROOT}/htdocs"
#站点文档目录
<Directory "${SRVROOT}/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
#根目录
<Directory />
    AllowOverride none
    Require all denied
</Directory>
#默认主页修改
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
#开启虚拟主机配置文件
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Apache虚拟主机文件配置

同时在windows的hosts文件中配置好主机名,即可访问。

#重新配置站点目录权限,覆盖httpd.conf中的目录权限配置
<Directory "${SRVROOT}/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
#配置多个虚拟主机
<VirtualHost *:80>
    DocumentRoot "${SRVROOT}/htdocs/test1.com"
    ServerName test1.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "${SRVROOT}/htdocs/test2.com"
    ServerName test2.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>