我一直在努力寻找解决方案几个小时。我有一个node.js服务器正在运行,它被nginx重定向,而另一个服务器我试图通过分配给第二个域的正常方式启动。我在启用了网站时有两个配置文件。第二个域重定向到第一个
文件1 - 重定向的node.js服务器端口
server {
listen 80;
server_name www.domain1.com domain1.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://VPS-IP:2368;
}
}
文件2 - php网站
server {
listen [::]:80;
server_name www.domain2.pl domain2.pl;
access_log /var/log/nginx/slucas.access.log;
error_log /var/log/nginx/slucas.error.log;
root /var/www2/dokuwiki;
index doku.php;
location ~ ^/(data|conf|bin|inc) {
return 404;
}
location ~ ^/lib.*\.(gif|png|ico|jpg)$ {
expires 31d;
}
location /tips {
rewrite ^(.*)$ http://blog.slucas.fr/en$1 permanent;
}
location / {
try_files $uri $uri/ @dokuwiki;
}
location @dokuwiki {
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
rewrite ^/tag/(.*) /doku.php?id=tag:$1&do=showtag&tag=tag:$1 last;
rewrite ^/(.*) /doku.php?id=$1&$args last;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/tmp/fcgi.sock;
}
}