Jump to content
Invision Community


  • Content count

  • Joined

  • Last visited

  1. Nginx Rewrite rules for IPB 3.0

    I have config files like this in /etc/nginx/sites-available. These are symlinked to sites-enabled and loaded in nginx.conf from there. After finding out that these configs worked, but routing was incorrect continuously. After starting from near blank config files to work out why my root directive was incorrect I discovered that it wasn't. Nginx roots all requests to the first root found if no other server name is defined. So why were my configs doing that? I decided to check permissions in both sites-available and in sites-enabled with ls -la. Only to see the symlinks were incorrect. default > default and forums > /etc/nginx/sites-available/forums The default config symlink was incorrect. Definitely check this if you can't get the vhosts to route correctly. I found out that you can't use relative paths in symlinks. ln -s default /etc/nginx/sites-available/default << DOES NOT WORK! You need to explicitly state paths in both cases.
  2. Nginx Rewrite rules for IPB 3.0

    After much turmoil I have managed it on my own server. I hope to make this an informative post governing some of the pitfalls I came across when setting up my sites-available file. Firstly: Here is my completed config file. Some was set up by a previous admin who had more experience with nginx than me. I had to modify his default file when I moved my forums. I'll explain the parts I changed: This is not in nginx.conf. It is in the sites-available directory and symlinked to sites-enabled which is included within nginx.conf. listen 80; server_name name.co.uk; access_log /var/log/nginx/forums.access.log; error_log /var/log/nginx/forums.error.log; root /var/www/forums/someotherdirectory/public_html; location /{ //No need for /var/www/forums/.... here. autoindex on; //Not really necessary, I was trying to debug, still never managed to get indexing to work anyway! index index.php index.htm index.html; //Can probably come out of the location block try_files $uri $uri/ /var/www/fourms/someotherdirectory/public_html/index.php?q=$uri&$args; //Rewriting as shown above } ## Parse all .php files in the /var/www directorylocation ~ .php$ {fastcgi_split_path_info ^(.+.php)(.*)$; fastcgi_pass backend;fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; (used to be /var/www <- This was the final piece of the puzzle, before this I tried /var/www/fourms/someotherdirectory/public_html/ which failed, after this correction was made the actual site worked, albeit missing its css which was due to the incorrect board_url in the conf_global file.) include fastcgi_params; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60;} } upstream backend {server;} server { Now the most important thing that prevented errors for me after this point was in nginx.conf the user directive was set to www-data. Whereas our files were chowned game:modg. In an attempt to not further modify permissions to 777 for everything xD! I changed the user directive to the owner of the files and this made the 403 errors disappear. Some of my sources: http://nginxlibrary....orbidden-error/ http://www.webhostin...ad.php?t=892228 I hope this helps.