Nginx with Fuelcms

edited February 2011 in Installation
It seem like not many people here is sharing how to run FUELCMS on nginx, after spending a few hour playing with it, this seem like working for me, please share if you have other way.


location / { if ($request_filename !~ (js|css|images|img|robots\.txt|index\.php.*) ) { rewrite ^/(.*)$ /index.php/$1 last; } location ~ /index.php/ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /usr/local/nginx/conf/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home/knight/public/$fastcgi_script_name; }

Comments

  • edited 4:30PM
    Thanks for the post and persistence (saw your tweet). You probably already saw this post, but I'll mention it here for others are in the same boat.
    http://www.getfuelcms.com/forums/discussion/comment/323/#Comment_323
  • edited 4:30PM
    Just want to update this post , I just wipe my dev vps and realiase I never backup my nginx setting, lucky I leave a post here , but I guess I should actually complete this.

    my setup
    ubuntu natty
    php-fpm
    nginx 1.0.4
    all install done by apt-get

    *replace domain.com with your own domain
    *replace home_path with your actual path

    edit the vhost on /etc/nginx/site-available/domain.com
    server { listen 80; server_name www.domain.com; rewrite ^/(.*) http://domain.com/$1 permanent; } server { listen 80; server_name domain.com; access_log /home_path/log/access.log; error_log /home_path/log/error.log; location / { root /home_path/public/; index index.php index.html; if ($request_filename !~ (js|css|images|img|robots\.txt|index\.php.*) ) { rewrite ^/(.*)$ /index.php/$1 last; } if (!-f $request_filename) { rewrite ^/(.*)(fuel/modules/.*) /$2 last; rewrite ^/(.*)(/assets/.*) /$2 last; } location ^~ /fuel/crons { deny all; } location ^~ /fuel/data_backup { deny all; } } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ /index.php/ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home_path/public$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } }

    once you done this, you might still see error, test it the login page http://domain.com/fuel/login/ , if this display properly, which mean the rewrite rules is working, checking on the error.log you will see there is some upstream error, which prevent the site to display properly.

    Just create /etc/nginx/conf.d/buffer.conf and leave these value in the conf file
    fastcgi_buffers 8 16k; fastcgi_buffer_size 32k;

    restart your nginx and you should be able to see your shining fuelcms working!
  • edited 4:30PM
    Thanks for posting this... I saw your tweet and was hoping you would add it to the forum to help those guys using nginx.
Sign In or Register to comment.