网页浏览总次数

星期四, 二月 15, 2024

Windows操作系统中nginx的使用

学习笔记(本地和租赁的服务器上都部署成功)。


http服务器下web项目

打开http://nginx.org/en/docs/windows.html点击download下载最新版本的nginx

解压到桌面即可


本地

使用命令行(WIN+R - cmd - cd Desktop - cd nginx(对应路径)) 进入到nginx.exe所在目录(不可以双击打开)


修改conf目录下的nginx.conf文件中 listen(默认为80)设置为0-65535之间任意server_name设置为localhost


html下建立web文件夹(把构建的web项目放到这下面)


访问链接 localhost:80/web/index.html即可


远程服务器


使用命令行(WIN+R - cmd - cd Desktop - cd nginx(对应路径)) 进入到nginx.exe所在目录(不可以双击打开)


修改conf目录下的nginx.conf文件中 listen 80 server_name设置为localhost 服务器外网ip 解析后的域名(www.test.com)


root   html/test;


index  test.html test.htm; 


访问链接 www.test.com即可(访问的主页面是nginx/html/Test/test.html)


test是举例,正常要更换成自己的需要的字符串。


没有评论:

发表评论