wordpress拒绝访问_Nginx + Wordpress页面或帖子URL返回拒绝访问
謝謝你的答案@ r3wt。但是,我猜上面的配置文件是不合適的我不想保持原樣(但是對(duì)于我來說開發(fā)似乎沒問題,因?yàn)椴渴鹞覍幵笧槊總€(gè)站點(diǎn)使用單獨(dú)的配置文件)。
所以,別名部分和我的問題應(yīng)該正確定義try_files因?yàn)槲蚁胍东@鏈接以localhost / szpetra開頭所以我添加它并取消注釋別名部分因?yàn)楝F(xiàn)在我清楚地了解root和別名whis之間的區(qū)別是什么是:
This will result in files being searched for in /foo/bar/bar as the full URI is appended.
location /bar {
root /foo/bar;
}
This will result in files being searched for in /foo/bar as only the URI part after /bar is appended.
location /bar {
alias /foo/bar;
}
資料來源:https://forum.nginx.org/read.php?2,129656,130107
現(xiàn)在修改后的配置文件如下所示:
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; # I used index definition here so I think I shouldn't define it under a 'location' field.
location ~ \.php$ {
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; #uncommenting alias helped me solve the problem
access_log /var/log/nginx/szpetra-access_log main;
error_log /var/log/nginx/szpetra-error_log info;
# index index.php index.html index.htm; # this doesn't need cause I defined the indexes above in the server{} section but I'm not sure that about this
try_files $uri $uri/ /szpetra/index.php?$args; # Adding this line helped me solve the problem
}}
總結(jié)
以上是生活随笔為你收集整理的wordpress拒绝访问_Nginx + Wordpress页面或帖子URL返回拒绝访问的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 升级吗?微软推Windows 11更新:
- 下一篇: fastdown.exe是什么进程吗 f