嗨我有一个运行wp的Nginx服务器没有问题。我只是在空白html5中创建了一个站点,并添加了一些使用php的功能。然后我的客户也决定写一个博客。所以我将Wordpress安装到了一个子目录中。我唯一的问题是我不能弄明白的Nginx配置。我在example.com/上有该网站,wp位于example.com/wp/site/上,但即使我已正确配置所有内容,但我的管理面板仍无法使用。所以我分享我的代码,我非常感谢一些帮助。我在网上发现了类似的文章,但他们根本没有帮助。所以请看看我的Nginx cfg为这个网站,并告诉我什么是错的。谢谢!WordPress的子目录nginx
server {
server_name domain.com;
listen 80;
root /var/www/domain;
include wordpress.conf;
location/{
index index.php index.html index.htm;
}
# Block PHP files in uploads directory.
location ~* /wp/acc/wp-content/uploads/.*\.php$ {
deny all;
}
location ~ ^/\.user\.ini {
deny all;
}
location /wp/acc {
limit_except GET POST OPTIONS HEAD { deny all; }
try_files $uri $uri/ /wp/acc/index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
server {
server_name domain.com;
listen 81;
root /var/www/domain;
index index.php index.html index.htm;
include wordpress7080.conf;
location/{
index index.php index.html index.htm;
}
# Block PHP files in uploads directory.
location ~* /wp/acc/wp-content/uploads/.*\.php$ {
deny all;
}
location ~ ^/\.user\.ini {
deny all;
}
location/{
limit_except GET POST OPTIONS HEAD { deny all; }
try_files $uri $uri/ /wp/acc/index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
附加信息:
WP-config.php文件没有被修改。 网址在数据库中是正确的。 wordpress.conf只包含nginx的基本wordpress设置。
我不是一个wordpress开发者,但我想你说的是第二个虚拟主机在端口81上侦听,你有没有在防火墙中启用它?如果您的server_name在这两个站点之间有所不同,那么您可以让他们两个都在端口80上侦听。 – MMT