permalink problem on nginx
-
I read Codex > Nginx and succeeded to have network install (subdirectory).
But I have two problems with permalink settings ( https://example.com/wp-admin/options-permalink.php ).
First, I see a slug
/blog
before input area.
Second, there is a slug/index.php/
in the input area.Please see screenshot.
I can’t get rid of either of them.
(/blog
is uneditable, and/index.php/
appears every time even I submit without/index.php/
…:( )I have these problems only at the main (blog id = 1) site.
Please if you know how to fix it, please let me know.
Here is my nginx config files.
nginx.conf:
user nginx; worker_processes 2; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; #tcp_nopush on; keepalive_timeout 3; #tcp_nodelay on; gzip on; #client_max_body_size 13m; index index.php index.html index.htm; log_not_found off; # Upstream to abstract backend connection(s) for PHP. # upstream php { # server unix:/tmp/php-fpm.sock; # server 127.0.0.1:9000; # } include sites-enabled/*; server { listen 80; server_name example.com; root /var/www/vhosts/example.com; if ($http_host != "example.com") { rewrite ^ https://example.com$request_uri permanent; } include global/restrictions.conf; include global/wordpress-ms-subdir.conf; access_log /var/log/nginx/colog.jp.access.log; }# end server{} }# end http {}
global/wordpress-ms-subdir.conf:
# This order might seem weird - this is attempted to match last if rules below fail. # https://wiki.nginx.org/HttpCoreModule location / { try_files $uri $uri/ /index.php?$args; } # https://j.mp/ni5J6W ##necessary if using a multi-site plugin server_name_in_redirect off; ##necessary if running Nginx behind a reverse-proxy #port_in_redirect off; # Add trailing slash to */wp-admin requests. rewrite /wp-admin$ $scheme://$host$uri/ permanent; # Directives to send expires headers and turn off 404 error logging. location ~ .*\.(txt|xml|html?|jpe?g|JPE?G|gif|GIF|png|PNG|swf|SWF|wmv|WMV|flv|FLV|css|CSS|js|JS|inc|ico|gz) { expires 24h; log_not_found off; break; } # Pass uploaded files to wp-includes/ms-files.php. rewrite /files/$ /index.php last; # For multisite: Use a caching plugin that creates symlinks to the correct subdirectory structure to get some performance gains. set $cachetest "$document_root/wp-content/cache/ms-filemap/${host}${uri}"; if ($uri ~ /$) { set $cachetest ""; } if (-f $cachetest) { # Rewrites the URI and stops rewrite processing so it doesn't start over and attempt to pass it to the next rule. rewrite ^ /wp-content/cache/ms-filemap/${host}${uri} break; } if ($uri !~ wp-content/plugins) { rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last; } # Uncomment one of the lines below for the appropriate caching plugin (if used). #include global/wordpress-ms-subdir-wp-super-cache.conf; #include global/wordpress-ms-subdir-w3-total-cache.conf; # Rewrite multisite '.../wp-.*' and '.../*.php'. if (!-e $request_filename) { rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last; rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last; rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last; rewrite ^.*$ /index.php last; } # Pass all .php files onto a php-fpm/php-fcgi server. location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/vhosts/colog.jp$fastcgi_script_name; include fastcgi_params; }
Thanks.
- The topic ‘permalink problem on nginx’ is closed to new replies.