1.cd /.../.../nginx/conf/(例如/usr/local/nginx/conf/)文件夹,新建*.conf(如net12.conf)

server {
  listen 888;
  server_name localhost;
  root /root/FirstApi/;
  index index.html index.htm;

  location / {
    proxy_pass http://localhost:5000;
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.

 2.编辑nginx.conf配置文件(vi nginx.conf)。

  在http{}里最后一行加上刚才创建的目录地址。(注意是在http{}里)

include /usr/local/nginx/conf/vhost/*.conf;
  • 1.

Nginx-Server常规配置_html

 

作者:꧁执笔小白꧂