FORUM IS CLOSED. PLEASE USE QUESTIONS / ANSWERS PAGE INSTEAD
Login  |  Forum  |  Search   

Board index » Development » Other




Post new topic Reply to topic  [ 6 posts ] 
 
Author Message
 Post subject: ImpressPages on nginx Webserver?
 Post Posted: Fri Sep 23, 2011 11:23 am 
Offline

Joined: Sat Mar 13, 2010 6:54 pm
Posts: 62
Does anybody have any experience setting up ImpressPages on a nginx webserver?

Or asked the other way around: Is there a specific reason, why only apache is named on the Requiremends page?

I am new to nginx as well, but I would like to try to convert from apache to nginx once I reconfigure my server from Debian to FreeBSD, and as far as I can see, there should be no reason, why ImpressPages would not run equally on nginx, except the uncertainty about the mod_rewrite extensions, although nginx should be able to handle that as well with its rewrite module.


Top 
 Profile  
 
 Post subject: Re: ImpressPages on nginx Webserver?
 Post Posted: Fri Sep 23, 2011 12:10 pm 
Offline
Project Manager

Joined: Wed Nov 25, 2009 9:40 am
Posts: 421
We never tried ImpressPages on nginx. Not much web developers use that. As you've said, there should be no reason why it shouldn't work. The only issue can be related with .htaccess file configuration. You need to update it to follow nginx syntax. If you successfully do that, please share the .htaccess file and any additional thoughts that will come up during the process.


Top 
 Profile  
 
 Post subject: Re: ImpressPages on nginx Webserver?
 Post Posted: Mon Nov 14, 2011 9:48 pm 
Offline

Joined: Mon Nov 14, 2011 9:37 pm
Posts: 2
Nginx itself doesn't use a .htaccess file, rewrite rules for each virtual server are set in "nginx.conf" - webserver's configuration file. The syntax of rewrite rules differs significantly from that of Apache so one need to experiment. Of course, you could always use Apache as a backend and nginx only as a reverse proxy but this is quite another story. I'm experimenting right now with those rewrite rules since nginx is giving me 404 errors.

[EDIT]
Yup, rewrite works but syntax is slightly different:
For old good Apache ->
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d]
RewriteRule ^(.*)$ index.php?%{QUERY_STRING} [L] # Typical ;)
For Nginx ->
rewrite ^/(.*) index.php?%QUERY_STRING; # Put this line into a virtual server configuration block. And this is ALL you need to do.
Hope this helps.


Top 
 Profile  
 
 Post subject: Re: ImpressPages on nginx Webserver?
 Post Posted: Tue Nov 15, 2011 5:26 pm 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
We want to share your knowledge with our community and add this script to documentation.

Am I right, that Nginx needs only one line in .htaccess?

Code:
rewrite ^/(.*) index.php?%QUERY_STRING;


Top 
 Profile  
 
 Post subject: Re: ImpressPages on nginx Webserver?
 Post Posted: Tue Nov 15, 2011 11:37 pm 
Offline

Joined: Mon Apr 18, 2011 5:23 am
Posts: 64
I too would be interested as i am currently working on developing more efficient servers to host ImpressPages on.


Top 
 Profile  
 
 Post subject: Re: ImpressPages on nginx Webserver?
 Post Posted: Wed Nov 16, 2011 9:59 pm 
Offline

Joined: Mon Nov 14, 2011 9:37 pm
Posts: 2
maskas wrote:
We want to share your knowledge with our community and add this script to documentation.

Am I right, that Nginx needs only one line in .htaccess?

Code:
rewrite ^/(.*) index.php?%QUERY_STRING;


Unfortunately from some unknown reasons the rewrite doesn't work anymore - I suspect some issues with fcgi but didn't have time for thorough investigation. Anyway - adding a codeblock that is also required by wordpress to work:
Code:
location / {try_files $uri $uri/ /index.php;}

made cms back alive again. The working (for now) virtual server config block from my nginx.conf file (in FreeBSD the path to the file is /usr/local/etc/nginx - there are also configuration files for fcgi in there) is as follows:
Code:
#ImpressPages development server
   server {
        listen      80;
        server_name  impresspages.local;
   #rewrite ^/(.*) index.php?%QUERY_STRING;
   index index.php index.htm index.html;

        #charset koi8-r;

        access_log  logs/local-impresspages.access.log  main;

   root   /var/www/impresspages;
      location ~ \.php$ {
         fastcgi_pass 127.0.0.1:8118;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
   }

   location / {
         try_files $uri $uri/ /index.php;
   }

      location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
         expires max;
         log_not_found off;
   }
   
   #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }
}

As you can see I commented out the line with rewrite rule.
Rewriting rules from Apache to Nginx is tricky stuff, sometimes nothing works properly even if it looks like it should... And I'm not the best nginx pro
No doubts that above config lacks some final touch but it works - no 404 errors. Enjoy and adjust it to your needs as you like :)


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 6 posts ] 

Board index » Development » Other


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron