天天看點

lnmp下的nginx代理

修改nginx.conf檔案,删除一下内容,配置預設虛拟主機:

建立虛拟主機配置目錄

<code></code>mkdir /etc/nginx/vhost``

server

{

listen 80;

server_name localhost;

index index.html index.htm index.php;

root /data/www;

location ~ .php$ 

include fastcgi_params;

fastcgi_pass unix:/tmp/php-fcgi.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;

}

增加

修改後的nginx配置檔案内容

&lt;html&gt;

&lt;head&gt;

&lt;title&gt;LNMP&lt;/title&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;

&lt;meta name="author" content="Gavin Zhao"&gt;

&lt;meta name="keywords" content="Centos7伺服器"&gt;

&lt;meta name="description" content=""&gt;

&lt;link rel="shortcut icon" href="favicon.ico" type="image/ico"&gt;

&lt;style type="text/css"&gt;

恭喜,lnmp 已安裝成功!

為安全起見,本頁可删除或重命名

添加虛拟主機代理: 1、confluence代理 80端口代理confluence的8090 vim /etc/ng``inx/vhost/itks.oceanwing.com.conf server { server_name itks.oceanwing.com listen 80; location / { proxy_pass http://172.16.20.247:8090/; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 2、Jenkins代理 ``` vim /etc/nginx/vhost/jenkins.oceanwing.com.conf server { server_name jenkins.oceanwing.com listen 80; location / { proxy_pass http://172.16.22.245:8080; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` ``` ``` 3、jira的代理 ``` vim /etc/nginx/vhost/jira.oceanwing.com.conf server { server_name jira.oceanwing.com listen 80; location / { proxy_pass http://172.16.20.247:8080/; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` ``` ```

本文轉自 喵來個魚 51CTO部落格,原文連結:http://blog.51cto.com/m51cto/2070278,如需轉載請自行聯系原作者

繼續閱讀