I have a local development environment with the followings installed:
- Nginx 1.8.1
- Wordpress 4.5.1
- PHP 5.6.20
In nginx.conf I included the /etc/nginx/conf.d/*.conf to successfully separate config files from each other. I have yet only one config file which contains configurations to all of my localhost websites from "phpmyadmin" to under development wordpress sites and my goal is to reach them as directories properly. I'm sure that I have problems in my poorly made nginx configuration, probably I should define a rewrite rule for url parameters but I can't find a solution:
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost-access_log main;
error_log /var/log/nginx/localhost-error_log info;
root /var/www/localhost/htdocs/;
index index.php index.html index.htm;
location ~ \.php$ {
# Test for non-existent scripts or throw a 404 error
# Without this line, nginx will blindly send any request ending in .php to php-fpm
try_files $uri =404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:run/php-fpm.socket;
}
location /phpmyadmin {
alias /var/www/localhost/htdocs/phpmyadmin;
access_log /var/log/nginx/phpmyadmin-access_log main;
error_log /var/log/nginx/phpmyadmin-error_log info;
}
location /samplewordpress {
alias /var/www/localhost/htdocs/samplewordpress;
access_log /var/log/nginx/samplewordpress-access_log main;
error_log /var/log/nginx/samplewordpress-error_log info;
}
location /szpetra {
alias /var/www/localhost/htdocs/szpetra;
access_log /var/log/nginx/szpetra-access_log main;
error_log /var/log/nginx/szpetra-error_log info;
}
}
I can log in to the admin page and everything works fine, but after I try to load a page or a post, it returns me an "Access denied" message.
Any ideas to solve this problem while I can keep the website in directories?