I have a WordPress blog hosted in a subdirectory called /blog
, I'm trying to have the pretty permalinks using the %postname%
string, but all it does is that it just returns a 404 error.
I've tried numerous solutions to try to fix this problem, but none have worked. Am I missing something or there's a better way to go about this? At this point the only thing I can think of is a permissions issue, but that's very unlikely.
My NGINX config file is below:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/allamericangold.com/html/blog;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name allamericangold.com www.allamericangold.com 104.198.9.91;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$args;
}
location /blog/ {
try_files $uri $uri/ /blog/index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
Add index index.php index.html index.htm;
inside location /blog/
block.
location /blog/ {
index index.php index.html index.htm;
try_files $uri $uri/ /blog/index.php$is_args$args;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.