I'm currently using the following nginx rewrite rules for my CMS, Blog, and Forums, which I've found posted in these forums:
I can't load actual threads, posts, and blogs. After making some changes, I'm able to load the members list, along with the list of threads (each forum.) Here's my config file for the virtual host, and then that for nginx itself (slightly modified):
Any ideas?
Thanks,
dk
Code:
rewrite ^/threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /showthread.php?t=$1&page=$2; rewrite ^/members/([0-9]+) /member.php?u=$1; rewrite ^/forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /forumdisplay.php?f=$1&page=$2;$ rewrite ^/blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /blog.php?u=$1&page=$2; rewrite ^/entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /entry.php?b=$1&page=$2; rewrite ^/list/([^/]*/)([0-9]+) /list.php?r=$1$2; rewrite ^/content/(.*) /content.php?r=$1;
Code:
server { listen 80; server_name x x x x; access_log /home/x/www/x/logs/access.log; error_log /home/x/www/x/logs/error.log; root /home/x/www/x/public_html/; location / { index index.php index.html index.htm; rewrite ^/live/threads/([0-9]+) /showthread.php?t=$1&page=$2; rewrite ^/live/members/([0-9]+) /member.php?u=$1; # rewrite ^/live/forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /forumdisplay.php?$ rewrite ^/live/forums/([0-9]+) /forumdisplay.php?f=$1; rewrite ^/blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /blog.php?u=$1&page=$2; rewrite ^/entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) /entry.php?b=$1&page=$$ rewrite ^/list/([^/]*/)([0-9]+) /list.php?r=$1$2; rewrite ^/content/(.*) /content.php?r=$1; } } # Pass PHP scripts on to PHP-FPM location ~* \.php$ { try_files $uri /index.php; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } }
Code:
user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml applicati$ ## # If HTTPS, then set a variable so it can be passed along. ## map $scheme $server_https { default off; https on; } ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
Thanks,
dk
Comment