Welcome! Log In Create A New Profile

Advanced

Re: Mass virtual hosting and global redirect

June 16, 2009 11:06AM
This is the whole conf:

nginx.conf:

user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log /var/log/nginx/access.log;

sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 3;

gzip on;
gzip_comp_level 1;
gzip_proxied any;
gzip_min_length 1024;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

and this is the enabled server file:

server {
listen 80;
server_name ~^[^.]+\.[^.]+$; # domain.com
rewrite ^ http://www.$host$request_uri?;
}

server {
listen 80 default;
server_name ~^(.*)\.(.*\..*)$;
set $sub $1;
set $domain $2;
root /var/www/vhosts/$domain/$sub;
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log error;

include /etc/nginx/conf/wordpress_params;

location / {
root /var/www/vhosts/$domain/$sub;
index index.php index.html;

if (-f $request_filename) {
expires 30d;
break;
}

if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
}

location ~* i.+\.(css|js|jpg|jpeg|gif|png)$ {
expires 7d;
}

location ~ "^(.+\.php)($|/)" {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}

location ~ /\.ht {
deny all;
}
}

and here's the wordpress_params file which is also included:

if (-f $request_filename) {
break;
}

set $supercache_file '';

set $supercache_uri $request_uri;

if ($request_method = POST) {
set $supercache_uri '';
}

# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $supercache_uri '';
}

if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $supercache_uri '';
}

# if we have not bypassed the cache, specify our supercache file
if ($supercache_uri ~ ^(.+)$) {
set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
}

# only rewrite to the supercache file if it actually exists
if (-f $document_root$supercache_file) {
rewrite ^(.*)$ $supercache_file break;
}

# all other requests go to Wordpress
if (!-e $request_filename) {
rewrite . /index.php last;
}

Unfortunately I can't recompile and install with debug flags right now as this is a production server. :-/
Subject Author Posted

Mass virtual hosting and global redirect

NoSync June 15, 2009 09:30AM

Re: Mass virtual hosting and global redirect

Igor Sysoev June 15, 2009 09:48AM

Re: Mass virtual hosting and global redirect

NoSync June 15, 2009 11:23AM

Re: Mass virtual hosting and global redirect

Igor Sysoev June 15, 2009 11:34AM

Re: Mass virtual hosting and global redirect

NoSync June 15, 2009 12:22PM

Re: Mass virtual hosting and global redirect

Igor Sysoev June 15, 2009 02:47PM

Re: Mass virtual hosting and global redirect

NoSync June 16, 2009 09:43AM

Re: Mass virtual hosting and global redirect

Igor Sysoev June 16, 2009 09:56AM

Re: Mass virtual hosting and global redirect

NoSync June 16, 2009 10:32AM

Re: Mass virtual hosting and global redirect

Igor Sysoev June 16, 2009 10:34AM

Re: Mass virtual hosting and global redirect

NoSync June 16, 2009 11:06AM

Re: Mass virtual hosting and global redirect

edogawaconan June 18, 2009 09:13AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 163
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready