Posted by fehin on May 11, 2013 at 8:01pm
My current setup is mysite.com and mysite.com/dev.
I have been able to get clean url to work with mysite.com/dev but not with mysite.com. I tried several setup examples that I found online but they either didn't work or broke one or both sites.
I would like to get clean url to work on both sites.
Here is my config
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name mysite.com www.mysite.com;
root /srv/www/mysite.com/public_html;
index index.php index.html index.htm;
access_log /srv/www/mysite.com/logs/access.log;
error_log /srv/www/mysite.com/logs/error.log;
include global/webmail.conf;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ../..php$ {
return 403;
}
location / {
# This is cool because no php is touched for static content
try_files $uri @rewrite;
}
location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^/([^/])/(.)(/?)$ /$1/index.php?q=$2&$args;
}
# Fighting with ImageCache? This little gem is amazing.
location ~ ^/sites/./files/imagecache/ {
try_files $uri @rewrite;
}
# Image styles for D7
location ~ /sites/./files/styles/ {
access_log off;
expires 30d;
try_files $uri @rewrite;
}
# Catch image styles for D7 too.
#location ~ ^/sites/./files/styles/ {
# try_files $uri @rewrite;
#}
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
# use fastcgi for all php files
location ~ .php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to apache .htaccess files
location ~ /.ht
{
deny all;
}
}