Hi I don’t have the steps for a how to but I’m running nginx.
I’ve posted my conf file for this vhost. It appears to run but I’m very new to expression engine so any feedback would be appreciated. This is also only for a single ee site.
Force URL query is off. (was on with urls like index.php?/
Once done, blank out the home page script name, in general conf. For me the links in templates where I’d used; {path='news/index'}, needed that to be blank to finally get no index.php in generated links.
Nginx conf file, note I’m using vhosts and a params file.
server {
listen 80;
server_name domain.co.uk domain2.com domain3.org;
index index.html index.php;
root /home/user/public_html;
#Support non-www
if ($host ~* www\.(.*)) {
set $host_without_www $1;
rewrite ^(.*)$ <a href="http://domain.co.uk$1">http://domain.co.uk$1</a> permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
}
#handles the tld issue.
if ($host != 'domain.co.uk' ) {
rewrite ^/(.*)$ <a href="http://domain.co.uk/$1">http://domain.co.uk/$1</a> permanent;
}
#Maintenance mode from capistrano deploy
if (-f $document_root/maintenance.html) {
rewrite ^(.*)$ /maintenance.html last;
break;
}
# If the file exists as a static file serve it directly without
# running all the other rewite tests on it
# serve static files directly
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires 30d;
}
#If the file physically exists, serve it… ifs are bad in nginx though, there is a better way of doing this.
if (-f $request_filename) {
break;
}
#EE customised rule, skip system folder and images folder, by rights images and system should of been served by now.
#Note the question mark still…
if ($request_filename !~ (system|images|robots\.txt|index\.php.*) ) {
rewrite ^/(.*)$ /index.php?/$1 last;
}
#Attempt to fix path_info, leaving the question mark works and covers testing domain.
location /index.php {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php?)(/.+)") {
set $script $1;
set $path_info $2;
}
}
#Finally mop up with anything left sent to the php-fpm engine.
error_page 404 /index.php;
location ~* .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
#Added for EE
fastcgi_param PATH_INFO $path_info;
}
}
Path info setting from this post: http://forum.slicehost.com/comments.php?DiscussionID=2950
I hope that helps you or anyone else get EE running on nginx. I’ll also be doing the same for litespeed, but suspect no issues arise there.
Cheers,
Colin