我在同一Ubuntu Server 14.04中具有nginx和apache2,我想使用nginx作为代理服务器。我的想法是,当人们写www.mysite.com或www2.mysite.com重定向到我拥有各自两个站点的apache时。
Nginx在端口80中,Apache在端口81中。
server {
listen 80;
root /var/www/;
index index.php index.html index.htm;
server_name example.com www.example.com www1.example.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:81;
}
location ~ /\.ht {
deny all;
}
}
希望能给您带来想法。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句