Tente remover a barra extra do fastcgi_param SCRIPT_FILENAME, para que a linha seja:
/home/me/public_html/domain2/public$fastcgi_script_name;
Eu estou tentando adicionar um segundo host virtual ao nginx. Quando eu vou para o novo domínio, ele redireciona para o antigo. Eu tentei reiniciar o Nginx, reinicializando o servidor.
Alguém já se deparou com isso antes, gostaria de compartilhar?
user www-data www-data;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 5;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
include /usr/local/nginx/sites-enabled/*;
}
server {
listen 80;
server_name www.domain1.co.uk;
rewrite ^/(.*) http://domain1.co.uk/$1 permanent;
}
server {
listen 80;
server_name domain1.co.uk;
access_log /home/me/public_html/domain1.co.uk/log/access.log;
error_log /home/me/public_html/domain1.co.uk/log/error.log;
location / {
root /home/me/public_html/domain1.co.uk/public/;
index index.php index.html;
# WordPress supercache & permalinks.
include /usr/local/nginx/conf/wordpress_params.super_cache;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/me/public_html/domain1.co.uk/public/$fastcgi_script_name;
}
}
server {
listen 80;
server_name www.domain2.co.uk;
rewrite ^/(.*) http://domain2.co.uk/$1 permanent;
}
server {
listen 80;
server_name domain2.co.uk;
access_log /home/me/public_html/domain2.co.uk/log/access.log;
error_log /home/me/public_html/domain2.co.uk/log/error.log;
location /
{
root /home/me/public_html/domain2.co.uk/public/;
index index.php index.html;
# Basic version of WordPress parameters, supporting nice permalinks.
# include /usr/local/nginx/conf/wordpress_params.regular;
# Advanced version of WordPress parameters supporting nice permalinks and WP Super Cache plugin
include /usr/local/nginx/conf/wordpress_params.super_cache;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/me/public_html/domain2/public/$fastcgi_script_name;
}
}
Tente remover a barra extra do fastcgi_param SCRIPT_FILENAME, para que a linha seja:
/home/me/public_html/domain2/public$fastcgi_script_name;
Eu coloquei uma página index.php no meu diretório e acessei através do navegador. Nenhum redirecionamento ocorreu. Então parece que o nginx não encontra o que está procurando, ele redireciona para outro domínio.
Tags hostname redirect nginx virtualhost