Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

After February 6, this site will no longer have Facebook, Twitter, or OpenID sign-in options. Read our announcement about social media SSO support in 2.8 for more info.

Make sure you have a current, valid email address set in your profile and set a password so you can login without it. If you get locked out after that time, you can choose "Forgot Password" to fix it as long as a valid email is on your account.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Can't access categories - Nginx + Nice URLs

CrogicCrogic New
edited July 2015 in Vanilla 2.0 - 2.3

Hello,

I can't access categories when I click on them.

/categories/general shows me all the categories and it just redirects me to the same page when I click on one.

Nginx Conf:

server {
  server_name ******.com;
  listen 80;
  root /var/www/html;
  access_log /var/log/nginx/****.com.access.log;
  error_log /var/log/nginx/*****.com.error.log;
  index index.php;

  location ~ \.php {
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include /etc/nginx/fastcgi_params;
#  fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
    location / {
        try_files $uri $uri/ @forum;
  }

  location @forum {
        rewrite ^(.+)$ /index.php?p=$1 last;
  }

  # protect uploads directory
  location ~* /uploads/.*\.(html|htm|shtml|php)$ {
        types { }
        default_type text/plain;
  }

  # Keep nosy people from deciphering 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; }

  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;
  }
  #location ~ /\.ht {
  #  deny  all;
  #}

}

Comments

  • hgtonighthgtonight ∞ · New Moderator

    This is the nginx server conf I use:

    server {
            listen 80;
            listen [::]:80;
    
            root ***/public_html;
            index index.php index.html index.htm;
    
            server_name ***.com www.***.com;
            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;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
                    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;
            }
    }
    

    I see a few differences between yours and mine, but nothing jumps out at me.

    I am not a nginx expert.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    wptolik
Sign In or Register to comment.