Par inadvertance, j'ai installé Wordpress à la racine de mon serveur Ubuntu nginx. Comment déplacer cette installation de la racine vers un sous-répertoire appelé / blog? ex. mysite.com/blog
Ce que j'ai maintenant:
server {
listen 80;
server_name mysite.com;
root /srv/www/wordpress;
index index.php index.html index.htm;
include conf.d/wp/restrictions.conf;
# Additional rules go here.
include conf.d/wp/wordpress.conf;
}
Ci-dessous, le fichier conf.d / wp / wordpress.conf
# WordPress single blog rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
index index.html index.htm index.php;
}
location /blog {
index index.html index.htm index.php;
try_files $uri $uri/ /blog/index.php?$args;
}
# 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 ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
# Uncomment the line below for the W3 total caching plugin (if used).
#include conf.d/wp/wordpress-w3-total-cache.conf;
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ \.php$ {
# Zero-day exploit defense.
# http://forum.nginx.org/read.php?2,88845,page=3
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
Malgré l'ajout de:
location /blog {
index index.html index.htm index.php;
try_files $uri $uri/ /blog/index.php?$args;
}
FYI Wordpress est toujours situé dans / srv / www / wordpress
... ça ne fonctionne toujours pas, ce qui me fait me demander si je comprends vraiment ce que je fais!
Toute aide est appréciée. Je vous remercie.