nginx跳转

来源:互联网 发布:windows主题手机 编辑:程序博客网 时间:2024/06/04 18:54

打开nginx.conf文件,执行命令vi nginx.conf:

 server {        listen       80;        server_name  localhost;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {           root   html;           index  index.html index.htm;        }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

修改上述文件中这部分的内容,如下:

 server {        listen       80;        # server_name  localhost;        server_name  http://104.69.205.247;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {           #root   html;           #index  index.html index.htm;           proxy_set_header Host $host;           proxy_set_header X-Real-Ip $remote_addr;           proxy_set_header X-Forwarded-For $remote_addr;           proxy_pass http://104.69.205.247:8086;        }        
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

保存修改后的文件,进入sbin目录,重启nginx服务:

./nginx -s reload
  • 1

重启成功


原创粉丝点击