php - nginx load wordpress from a subdirectory -
i followed guide here install wordpress on ubuntu server. upon entering url http://mydomain.com loads me front page.
server { listen 80 default_server; root /var/www/wordpress; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
i want load wordpress subdomain i.e., http://mydomain.com/wordpress. went on modify location can't load (it still looks files under http://mydomain.com).
root /var/www; index index.php index.html index.htm; location /wordpress { try_files $uri $uri/ /index.php?q=$uri&$args; }
or
location /{ try_files $uri $uri/ /wordpress/index.php?q=$uri&$args; }
how fix this? thanks
your wordpress looking files in root directory. / need tell him, search files in right directory. /wordpress/ there 2 ways. better: change path using wordpress config file rewriting resources path
from
/css/*, /* etc
to
/wordpress/css/*, /wordpress/* , on.
worst: redirect wordpress resources root directory. this:
location ~ ^/images/(.*)$ { try_files $uri /wordpress/images/$uri =404; access_log off; }
Comments
Post a Comment