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.

Can't access categories - Nginx + Nice URLs

CrogicCrogic New
edited July 2015 in Vanilla 2.0 - 2.8

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.

Sign In or Register to comment.