Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Nginx problem

edited January 2012 in Vanilla 2.0 - 2.8

Hi everyone,

I managed to install and configure VF (2.1a9) successfully as a root of my domain (non-embedded). Yet certain urls do not work as they should under Nginx (1.0.11).

Here is the example:
/dashboard/settings
/messages/all

work as they should, however /entry/signout?TransientKey=xxx and lots of other urls with extra parameters after "?" does not work at all. The "signout" does not do its job , however it shows login page as if it already signed out the user. The same goes for entry/register?Target=%2F and other urls I do not remember now.

In a nutshell: no url is working that contains extra ?parameters.

What is the issue and how to fix that? Thanks!

Tagged:

Answers

  • ToddTodd Chief Product Officer Vanilla Staff

    There's something you've got wrong in your nginx conf. There are quite a few discussions around regarding Vanilla and nginx. Try giving a few of them a read and see if anything rings a bell.

  • ToddTodd Chief Product Officer Vanilla Staff

    I'm not going to be able to help you more than this. Nginx is not my bag and usually people that use it have to know how to tinker with it.

    Here's a snippet from our server config:

       ## Default location
       location / {
          try_files $uri @site;
       }
    
       location @site {
          rewrite ^ /index.php?p=$uri&$args last;
       }
    
  • hbfhbf wiki guy? MVP

    I've had great results with apache... just sayin'.

  • rotaechorotaecho Los Angeles New
    edited December 2014

    This is to help another getting nginx up and running, also have anyone point out improvements that can be made to this configuration.

    I’m attempting to get Vanilla 2.1.5 setup using nginx 1.0.15 with php 5.3.3 with APC on CentOS 6.5 x86_64 working.

    @designa

    So, reading the suggested links you gave here is the input I encountered of the various issues:

    1.) Config offered from Mark, the links directed on the browser, but none of the pages updated. I tested this with a few browsers. Going to the sign-in button opened a listing of the forum categories.

    Then I attempted mykeus config which did the same behavior above.

    Then I attempted eleith’s config same as above

    Then I attempted Tim Lord of Servers config and just got a blank page.

    2.) Using the github nginx example, gives a 403 Forbidden at the root page.

    3.) & 4.) & 5.) Doesn’t really provide a useful nginx vanilla config

    The best article that remotely came close to working was this one:

    http://vanillaforums.org/discussion/19642/documentation-self-hosted-vanilla-on-nginx

    This below configuration file has been used on a few CentOS deployments without a hitch (thus far).

    The configuration file I’m currently running with is the following:

    From /etc/nginx/conf.d/vforums.conf

    # Based off of: http://vanillaforums.org/discussion/19642/documentation-self-hosted-vanilla-on-nginx
    
        server {
            server_name www.somedomain.com;
            root /app/www/vanilla;
            index index.php default.php index.html;
            autoindex off;
        # Error handling
            error_page 404 /dashboard/home/filenotfound;
            error_page 403 =404 /dashboard/home/filenotfound;
        # Root location
            location / {
                try_files $uri $uri/ @forum;
            }
        # Rewrite to prettify the URL and hide the ugly PHP stuff
            location @forum {
                rewrite ^/(.+)$ /index.php?p=$1 last;
            }
        # PHP handler
            location ~ \.php {
                try_files $uri =404;
                include fastcgi_params;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
            }
    
        # Stop things from executing in the uploads directory
            location ~* ^/uploads/.*.(html|htm|shtml|php)$ {
                types { }
                default_type text/plain;
            }
        # Keep nosey people from discivering categories by number
            location ~* /categories/([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$ {
                return 404;
            }
        # Deny, drop, or internal locations
            location ~ /\. { access_log off; log_not_found off; deny all; }
            location ~ ~$ { access_log off; log_not_found off; deny all; }
            location = /robots.txt { access_log off; log_not_found off; }
            location ^~ favicon { access_log off; log_not_found off; }
            location ^~ /conf/ { internal; }
        # Taking advantage of browser caching for static stuff
            location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|woff|ttf|svg)$ {
                expires max;
                log_not_found off;
            }
        #
        # Change some undesirable behavior & force things to display things like a traditional forum
        #    
            location = /discussions {
                rewrite ^ $scheme://www.somedomain.com/ permanent;
            }
            location = /discussions/ {
                rewrite ^ $scheme://www.somedomain.com/ permanent;
            }
            location = /categories/discussions {
                rewrite ^ $scheme://www.somedomain.com/ permanent;
            }
            location = /categories/discussions/ {
                rewrite ^ $scheme://www.somedomain.com/ permanent;
            }
            location /vanilla/discussions {
                rewrite ^ $scheme://www.somedomain.com/ permanent;
            }
            location /vanilla/discussions/ {
                rewrite ^ $scheme://www.somedomain.com/ permanent;
            }
        #
        # These locations were suggested to comment 
        #
        #location /dashboard/notifications/inform { access_log off; log_not_found off; }
        #location /settings/analyticstick.json { access_log off; log_not_found off; }
    
        #
        #  Plug-in specific rules
        #
        #  Keep the WhosOnline plugin from flooding the logs
            location /plugin/imonline { access_log off; log_not_found off; }
        }
    
  • rotaechorotaecho Los Angeles New

    The above configuration I posted had issues with lines: 53-69 with the rewrite rules. Once removed many more features are working properly.

  • if you are not rewriting then you must make

    $Configuration['Garden']['RewriteUrls'] = FALSE;

    but....

    if you are not rewriting I believe some things don't work properly.

    so you must rewrite correctly with server rules...
    and if you do..
    $Configuration['Garden']['RewriteUrls'] = TRUE;

    the mismatch possibly cause the 400 errors.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.