WordPress Multiste in a subdirectory – nginx
-
Hello Guys,
I moved my sites from a shared hosting to a VPS (linode).
Using a LEMP configuration (with Nginx and PHP-FPM)?and?have my 4 domains working fine.Except for 1 problem. In 1 domain i have an installation ?of drupal in the root directory, and an installation of wordpress multisite in a subdirectory. This worked well with Apache, but i can’t configure it properly with nginx.
The drupal site is working fine. But the worpress site is not showing any file (css,js,jpg) from the template directory, just showing the text and files uploaded from posts or widgets. Also, i can’t get into the administration panel, it gives me a 500 internal server error.
I’m completly new to nginx so the problem must be is in my configuration file, maybe you guys can help me out:
server { listen 80; server_name www.domain.tld; rewrite ^/(.*) https://domain.tld/$1 permanent; } server { listen 80; server_name domain.tld; access_log /home/username/public_html/domain.tld/log/access.log; error_log /home/username/public_html/domain.tld/log/error.log; location / { root /home/username/public_html/domain.tld/public; index index.php index.html; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; } } location /subdomain { root /home/username/public_html/domain.tld/public/subdomain; index index.php index.html; rewrite /wp-admin$ $scheme://$host$uri/ permanent; rewrite ^.*/files/(.*)$ /subdomain/wp-includes/ms-files.php?file=$1 last; if (!-e $request_filename) { rewrite ^.+/?(/wp-.*) /subdomain/$1 last; rewrite ^.+/?(/.*\.php)$ /subdomain/$1 last; rewrite ^(.+)$ /subdomain/index.php?q=$1 last; rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ /subdomain/$1 last; } } location ~* ^/subdomain/.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { root /home/username/public_html/domain.tld/public/subdomain; rewrite ^/.+(/wp-.*/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /subdomain/$1 last; rewrite ^.+/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /subdomain/wp-includes/ms-files.php?file=$1 last; expires 30d; break; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home/username/public_html/domain.tld/public/$fastcgi_script_name; } }
- The topic ‘WordPress Multiste in a subdirectory – nginx’ is closed to new replies.