我正在尝试将另一个站点添加到我的nginx服务器。问题是服务器没有为第二个站点执行php。
此页面无效xxx.com重定向您太多次。
已经有一周的时间试图解决这个问题了,我刚刚从apache切换到nginx。任何帮助表示赞赏。
默认情况下(站点1):
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
网站2我试图添加:
server {
listen 80;
listen [::]:80;
root /var/www/xxxs.com/html;
index index.php index.html;
server_name xxxs.com www.xxxs.com;
location / {
try_files $uri $uri / /index.php?q=$uri&$args;
}
location ~\.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~/\.ht {
deny all;
}
}
这两个网站都运行wordpress。当我尝试在第二个网站上打开文本文件时,它完美地工作
太空很重要。这些线条错过了空间。
1. try_files $uri $uri/ /index.php?q=$uri&$args;
2. location ~ \.php$ {
3. location ~ /\.ht {
完整的配置:
server {
listen 80;
listen [::]:80;
root /var/www/xxxs.com/html;
index index.php index.html;
server_name xxxs.com www.xxxs.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}