我已经安装了本地开发环境与如下:的Nginx + WordPress的页面或帖子的网址返回访问被拒绝
- Nginx的1.8.1
- 的WordPress 4.5.1
- PHP 5.6.20
在nginx.conf我包括/etc/nginx/conf.d/*.conf从EAC成功独立的配置文件h其他。我还没有只有一个配置文件,其中包含所有我的本地主机网站从“phpmyadmin”到开发WordPress站点的配置,我的目标是作为目录正确地联系到他们。我敢肯定,我在我的劣质nginx的配置问题,或许我应该定义URL参数重写规则,但我不能找到一个解决方案:
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost-access_log main;
error_log /var/log/nginx/localhost-error_log info;
root /var/www/localhost/htdocs/;
index index.php index.html index.htm;
location ~ \.php$ {
# Test for non-existent scripts or throw a 404 error
# Without this line, nginx will blindly send any request ending in .php to php-fpm
try_files $uri =404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:run/php-fpm.socket;
}
location /phpmyadmin {
alias /var/www/localhost/htdocs/phpmyadmin;
access_log /var/log/nginx/phpmyadmin-access_log main;
error_log /var/log/nginx/phpmyadmin-error_log info;
}
location /samplewordpress {
alias /var/www/localhost/htdocs/samplewordpress;
access_log /var/log/nginx/samplewordpress-access_log main;
error_log /var/log/nginx/samplewordpress-error_log info;
}
location /szpetra {
alias /var/www/localhost/htdocs/szpetra;
access_log /var/log/nginx/szpetra-access_log main;
error_log /var/log/nginx/szpetra-error_log info;
}
}
我可以登录到管理页面,一切工作正常,但我尝试加载一个页面或一篇文章后,它返回“拒绝访问”消息。
任何想法来解决这个问题,而我可以保持网站的目录?
你有一个不正确的nginx的配置。什么是'别名'?此外,你是否想要使用漂亮的网址?您也没有在任何位置块中定义索引文档。去阅读nginx文档,更好的,但谷歌如何设置WordPress的Nginx。 – r3wt
https://codex.wordpress.org/Nginx –