JAVA和Nginx 教程大全

网站首页 > 精选教程 正文

云主机:如何修改Nginx的默认端口

wys521 2024-09-22 17:52:19 精选教程 20 ℃ 0 评论

修改 nginx.conf 文件实现。

1server {

2 listen 80;

3 server_name localhost;

4


5 ……

6}

改成

01server {

02 listen 81;

03 server_name localhost;

04


05 location / {

06 root html;

07 index index.html index.htm;

08 }

09 ……

10}

当然改成 8080,8081 什么的都可以,不一定要 81,但是确保 iptable 要放开对该端口的访问。

注意到 location 的配置:

  • root html; #根目录,相对于安装目录
  • index index.html index.htm; #默认主页

默认,你把文件放在安装目录下的 html 文件夹,

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表