如何搭建自己的Web服务器(一)
1、以管理员权限运行PowerShell,如图所示。
2、安装chocolatey: 在power shell中执行:Set-ExecutionPolicyAllS足毂忍珩igned;iex((New-ObjectSystem.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
3、其中遇到两个提问:是否要更改执行策略?选:A是否要运行来自此不可信发布者的软件?选:A
4、安装nginx在power shell 中输入:choco install nginx -y
5、打开nginx/tools文件夹:在power shell 中输入:explorer C:\ProgramData\chocolatey\lib\nginx\tools
6、在文件夹内: 打开nginx-1.12.1 --打开conf文件夹--用非记事本的编辑器(没有的话,chocoinstallnotepadplusplus )打开nginx.conf 文件
7、在nginx-1.12.1文件夹下,找到html文件夹,并重命名为html_
8、在pawer shell里面输入:cdC:\ProgramData\chocolatey\lib\nginx\tools再输入:chocoinstallpstools
9、Do you want to run the script?([Y]es/[N]o/[P]rint): Y
10、powershell里面执行:cd觊皱筠桡C:\ProgramData\chocolatey\lib\nginx\tools\nginx-1.12.1cmd/cmklink/dhtml 项目的绝对路径
11、power shell里执行:cd ..nginx
12、power shell里执行:cdnginx-1.12.1nginx
13、在弹出的网络防火墙页面 两个框都打勾,允许访问。
14、最后试试访问localhost:80、试试访问你的ngrok。到这里,我们的web服务器已经顺利搭建完毕,并成功添加了我们的项目在服务器上。
15、附1:在桌面建立个后辍为bat的文件,内容为:cdC:\ProgramData\chocolatey\lib\ngin旌忭檀挢x\tools\nginx-1.12.1nginx注:关闭这个窗口服务器就停止运行 ;打开bat就运行。
16、附2:改项目的话,cmd 以管理员身份运行罕铞泱殳cdC:\ProgramData\chocolatey\lib概嗤先眚\nginx\tools\nginx-1.12.1del/f/qhtmlmklink/dhtml项目绝对位置
17、今天就给大家介绍这些,谢谢大家的支持!