我已經安裝了本地開發環境與如下:的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 –