當前位置:編程學習大全網 - 腳本源碼 - centos下nginx怎麽配置域名

centos下nginx怎麽配置域名

①- 找到配置文件中的 server 上下文。

###記住默認在nginx.conf文件中,但是默認監聽在80端口,server_name 為localhost,可以在這個上面改,也可以另見壹個配置文件

②-找到關鍵server_name

配置域名 server_name xx.xx.xx

###假如xx.xx.xx為域名

③-記得 80 端口 和 443端口都要配置

###如果有https的話

④-另見壹個配置文件的話。

需要在nginx.conf把這個文件包含進去

然後這個文件中配置server的內容如:

server

{

listen 80;

server_name xx.xx.xx;

location ~* \.(mp3|exe)$ {

proxy_pass http://這裏配置後端代理的應用服務器地址;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

  • 上一篇:媽媽再愛我壹次的故事梗概
  • 下一篇:大怪獸rush的HOT HUNTERS COOL HUNTERS
  • copyright 2024編程學習大全網