Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Nginx Support #120

Open
R-J opened this issue Feb 5, 2017 · 0 comments
Open

Nginx Support #120

R-J opened this issue Feb 5, 2017 · 0 comments

Comments

@R-J
Copy link

R-J commented Feb 5, 2017

I've tried the below conf file. It is not optimized and I'm no nginx specialist and so I managed to do everything I've tried except replying to a thread. So this is not finished but it might serve as a start for anyone interested.

server {
	server_name example.com;
	listen 80;
    listen [::]:80;
	index index.php index.htm index.html;
    charset UTF-8;

	auth_basic "Herein";
	auth_basic_user_file /usr/share/nginx/html/.htpasswd;

	root /var/www/AddictiveCommunity;

    # prevent external access to sensible data
    autoindex off;
    location /config.ini {
        deny all;
    }

    # error routing
    error_page 403 /403;
    error_page 404 /404;
    error_page 500 /500;
    location /403 {
        try_files $uri /index.php?c=failure&t=403;
    }
    location /404 {
        try_files $uri /index.php?c=failure&t=403;
    }
    location /500 {
        try_files $uri /index.php?c=failure&t=403;
    }

    # special routing
    location /logout {
        try_files $uri /index.php?c=login&act=logout;
    }
    location /thread {
        rewrite ^/(thread)/([0-9]+)-(.+)$ /index.php?c=$1&id=$2;
    }

    # default routing
    location / {
        rewrite ^/([a-zA-Z0-9_-]+)$ /index.php?c=$1;
        rewrite ^/([a-zA-Z0-9_-]+)/([0-9]+)$ /index.php?c=$1&id=$2;
        rewrite ^/([a-zA-Z0-9_-]+)/([a-zA-Z_]+)$ /index.php?c=$1&act=$2;
        rewrite ^/([a-zA-Z0-9_-]+)/([a-zA-Z_]+)/([0-9]+)$ /index.php?c=$1&act=$2&id=$3;
    }

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		include fastcgi_params;
	}
}

But I needed to do some other changes.

In order to install the forum, I have changed /install/index.php to look like that at around line 175:

// Check Apache extensions
if(function_exists('apache_get_modules') && apache_get_modules()) {

When viewing a thread, I saw a complain about the server variable REDIRECT_URL which is, as far as I know, an invention of Apache and not part of http spec. So I changed it to REQUEST_URI in /templates/default/Thread/index.phtml around line 257

@brunnopleffken brunnopleffken mentioned this issue Apr 12, 2017
8 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant