我在该网络服务器上使用nginx的vps我在/etc/nginx/conf.d上获得了2个conf(host1.com,host2.com)文件但是对同一站点有2个域访问权限。这些网站使用不同的技术1 PHP(运行在88上的Apache)和1个python(gunicorn运行在5000)这两个站点都可以使用这些端口从外部正确访问。
网站1 conf
server{
listen 80;
root /var/www/host1.com/public;
index index.php index.html index.htm;
server_name host1.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:88;
}
location ~ /\.ht {
deny all;
}
}
host2 conf
server {
listen 80;
server_name host2.com;
access_log /var/log/nginx/fundacion.log;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
提前致谢。
答案 0 :(得分:1)