nginx跳轉

打開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

重啓成功


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章