Deploying concrete5 on nginx
Permalink 1 user found helpful
I have a concrete5 site that works 'out of the box' in apache server. However I am having a lot of trouble running it in nginx.
The following is the nginx configuration i am using:
I am able to get the homepage but am having problem with the inner pages. The inner pages display an "Access denied". Possibly the rewrite is not working, in effect I think its querying and trying to execute php files directly instead of going through the concrete dispatcher.
I am totally lost here.
Thank you for your help, in advance.
The following is the nginx configuration i am using:
server { root /home/test/public; index index.php; access_log /home/test/logs/access.log; error_log /home/test/logs/error.log; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ index.php; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } # pass the PHP scripts to FastCGI server listening on unix socket # location ~ \.php($|/) {
Viewing 15 lines of 25 lines. View entire code block.
I am able to get the homepage but am having problem with the inner pages. The inner pages display an "Access denied". Possibly the rewrite is not working, in effect I think its querying and trying to execute php files directly instead of going through the concrete dispatcher.
I am totally lost here.
Thank you for your help, in advance.
@dandev
It was my responsibility towards the community to post the solution here, so that others can benefit from it. I am very sorry for not doing so.
I am reposting the solution that I posted on SO to help future visitors.
Changed the configurations to:
It was my responsibility towards the community to post the solution here, so that others can benefit from it. I am very sorry for not doing so.
I am reposting the solution that I posted on SO to help future visitors.
Changed the configurations to:
server { root /home/test/public; index index.php; access_log /home/test/logs/access.log; error_log /home/test/logs/error.log; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.php/$request_uri; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } # pass the PHP scripts to FastCGI server listening on unix socket # location ~ \.php($|/) {
Viewing 15 lines of 28 lines. View entire code block.
Thanks, this worked very well, without requiring rewrite rules for PHP files.
It does need an improvement, to correctly serve some CSS files:
It does need an improvement, to correctly serve some CSS files:
location ~ ^/index.php/tools/css/themes/(.+) { try_files /concrete/themes/$1 =404; }
I'm not sure that's a good idea. concrete5 does serve CSS files through index.php because depending on the theme, it replaces some variables.
Basically you can specify CSS variables which a user of concrete5 can change in the dashboard! To me, it looks like that rule would make that impossible!?
Basically you can specify CSS variables which a user of concrete5 can change in the dashboard! To me, it looks like that rule would make that impossible!?
http://stackoverflow.com/questions/11226624/deploying-concrete5-on-...