Need Help Configuring Nginx to run Wordpress
mike
mike503 at gmail.com
Fri Apr 25 11:43:52 MSD 2008
I posted mine.
user www-data www-data;
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
working_directory /var/run;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stre
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_max_body_size 100m; # More if you need up upload files
larger than 50mb
client_header_buffer_size 8k;
large_client_header_buffers 12 6k;
keepalive_timeout 5;
server_tokens off;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
server {
listen 80;
server_name michaelshadle.com www.michaelshadle.com;
index index.php index.html;
root /home/mike/web/michaelshadle.com/;
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {
expires 30d;
}
location ~ .php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:11000;
fastcgi_index index.php;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /wordpress/index.php?q=$1 last;
}
}
}
and my /etc/nginx/fastcgi.conf:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
my wordpress is physically hosted inside of /wordpress/
otherwise, everything else is handled by either normal handling or the
!-e check, which passes it through wordpress.
piece of cake :)
configure for PHP
'./configure' '--enable-fastcgi' '--enable-discard-path'
'--enable-force-cgi-redirect' '--enable-fpm'
'--with-fpm-pid=/var/run/php-fpm.pid'
'--with-fpm-log=/var/log/php-fpm.log'
'--with-fpm-conf=/etc/php-fpm.conf' '--enable-cli'
'--enable-inline-optimization' '--disable-rpath' '--disable-ipv6'
'--enable-mbstring' '--enable-mbregex' '--enable-sqlite-utf8'
'--with-mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-curl'
'--with-zlib' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr'
'--with-freetype-dir' '--enable-gd-native-ttf' '--enable-exif'
'--enable-shmop' '--with-xsl=shared' '--with-mssql=shared'
'--enable-soap=shared' '--enable-sockets' '--enable-pcntl=shared'
'--with-mcrypt' '--with-bz2' '--with-tidy' '--with-pcre-dir'
'--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-pear'
On 4/25/08, Todd HG <lists at ruby-forum.com> wrote:
> Since you were able to successfully get Nginx to run Wordpress, would
> you mind posting your config file?
More information about the nginx
mailing list