I have a medium to large size WordPress site running off a MediaTemple NGINX server, and CENTOS and I’m having trouble getting any location block properties applied. What the goal is, is to have a directory locked down so that only the server has access to it. From everything I’ve seen, the root I’m setting and the locations blocks are being called correctly, they just don’t seem to be being noticed.
#user nginx;
worker_processes 24;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
# rewrite_log on;
include 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;
#gzip_disable "MSIE [1-6].(?!.*SV1)â;
index index.php index.html index.htm
server_tokens off;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
include /etc/nginx/conf.d/*.conf;
include fastcgi.conf;
server {
listen 80;
server_name domainname.com;
rewrite ^ $scheme://www.domainname.com$request_uri redirect;
}
server {
listen 80;
server_name www.domainname.com;
root /var/www/vhosts/domainname.com/httpdocs;
# Additional rules go here.
location ^~ /protected-folder/ {
allow 127.0.0.1;
deny all;
}
# include global/restrictions.conf;
location ~* .php$ {
try_files $uri =404; # This is not needed if you have cgi.fix_pathinfo = 0 in php.ini (you should!)
fastcgi_pass 127.0.0.1:9000;
}
# Only include one of the files below.
include global/wordpress.conf;
# include global/wordpress-ms-subdir.conf;
# include global/wordpress-ms-subdomain.conf;
}
}
After every change I’m running:
sudo service nginx restart
Do I have to do a full server reboot?
Is there something wrong with the syntax above?
For any imports above, the content follows almost identical to the WordPress article on setting up NGINX for WordPress.
Any help on this would be appreciated.