XF 1.5 strip www and force https

malachiel

Active member
Hi i just trying to setup correct nginx for reach to:
- enable https for all site, except a folder called "launcher"
- remove www

I tried this, the solution seem to work, but when i enter in the xenforo forum located in the folder "community" it trow error 403 saying that i dont have access
Code:
server {
    listen   80;
    listen   [::]:80;
    listen   443;
    ssl on;
    ssl_certificate /etc/nginx/certificato.pem;
    ssl_certificate_key /etc/nginx/key.pem;
    index index.php index.html;

    root /var/www/html;

    server_name www.trollandia.it trollandia.it;
    return 301 https:/trollandia.it$request_uri;

    location /community/ {
        try_files $uri $uri/ /community/index.php?$uri&$args;
        index index.php index.html;
    }

    location /community/install/data/ {
        internal;
    }
    location /community/install/templates/ {
        internal;
    }
    location /community/internal_data/ {
        internal;
    }
    location /community/library/ {
        internal;
    }
    
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}

server {
    listen 443 ssl;
    server_name www.trollandia.it;
    ssl_certificate /etc/nginx/certificato.pem;
    ssl_certificate_key /etc/nginx/key.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    return 301 https://trollandia.it$request_uri;
    root /var/www/html;
}

server {
    listen 443 ssl;
    server_name trollandia.it;
    ssl_certificate /etc/nginx/certificato.pem;
    ssl_certificate_key /etc/nginx/key.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    root /var/www/html;
}
 
Back
Top Bottom