I am currently using Nginx to serve images only, but I have written a
script to launch the Nginx process, and php-cgi processes needed to run
Wordpress. I don’t seem to have the cofiguration correctly written, and
I’m not sure where I am making my error, so I could use some help. I
also don’t use the wp-cache, or Supercache plugins. I am running a
RedHat 5 Enterprise Server. Here is my configuration:
server {
listen my_ip_address:80;
server_name www.mydomain.com mydomain.com;
error_page 404 http://www.mydomain.com/e404.php;
location / {
root /var/www/mydomain;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
}
I am currently using Nginx to serve images only, but I have written a
script to launch the Nginx process, and php-cgi processes needed to run
Wordpress. I don’t seem to have the cofiguration correctly written, and
I’m not sure where I am making my error, so I could use some help. I
also don’t use the wp-cache, or Supercache plugins. I am running a
RedHat 5 Enterprise Server. Here is my configuration:
Ok, but what is the problem/error that you’re seeing?
And be sure to notice that you just opened up a HUGE hole in that ANY
.php file on the filesystem is now executable. This means if you have
an upload dir then if someone can upload a file with a .php extension to
it then they can point their browser to it and trigger the rule above to
execute that file… ugg
Limit the regexp to only trigger on dirs that you expect php scripts to
be in - OR - setup a location for the upload dir with a break in it to
take precedence over the .php rule.
The stuff above looks basically ok - you need to post your error
messages to get more help
is better too, then you can put it in an include. Otherwise, each
virtual host’s path needs to be hardcoded (and it doesn’t need to be!)
Just make sure the “root” of your vhost has the ending slash/; - I
stumbled across that one.
Also fastcgi_pass might be different per vhost (different fastcgi
pools, based on user ID for example) - basically, put everything
that’s the same in an include, and keep only the specific stuff
outside of it. I agree with Ed but wanted to point out a couple
exceptions
I’m getting black pages when trying to get to the web site, but I can
navigate around the Wordpress control panel just fine. I can’t see my
error. Here’s my entire config:
user nobody;
worker_processes 2;
pid /usr/local/nginx/logs/nginx.pid;
events {
worker_connections 12000;
use epoll;
}
http {
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;