Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

How Do I Add Permalinks Support on SSL with Nginx?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
5 posts • Page 1 of 1
lotusming
Posts: 16
Joined: Fri Jun 10, 2016 6:34 pm

How Do I Add Permalinks Support on SSL with Nginx?
  • Quote

Post by lotusming » Mon Oct 17, 2016 4:53 pm

Running a wordpress site on Nginx with PHP-FPM. How do I get permalinks to work correctly with SSL from letsencrypt? My config is below that generates 404 when permalinks are enabled:

Code: Select all

server {
    listen 80;
    server_name example.com www.example.com;
    return 302 https://example.com$request_uri;
}

server {
    listen      443 ssl;
    server_name example.com www.example.com;
    root        /home/admin/web/example.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/example.com.log combined;
    access_log  /var/log/nginx/domains/example.com.bytes bytes;
    error_log   /var/log/nginx/domains/example.com.error.log error;

    location / {

        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location / {
    try_files $uri $uri/ /index.php?$args;
}
        client_max_body_size 50M;

        location ~ [^/]\.php(/|$) {
           try_files $uri =404;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9001;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
 }

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /.well-known/acme-challenge {
    default_type text/plain;
    root /etc/letsencrypt/webroot;
}

    location /error/ {
        alias   /home/admin/web/example.com/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
       access_log off; log_not_found off; expires max;
}

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.example.com.conf*;
}

Top

lotusming
Posts: 16
Joined: Fri Jun 10, 2016 6:34 pm

Re: How Do I Add Permalinks Support on SSL with Nginx?
  • Quote

Post by lotusming » Thu Oct 20, 2016 6:27 pm

One thing I hate about this forum. People barely answer you. Incase you have the same problem here's the solution.

edit these two files:

Code: Select all

/home/username/conf/web/snginx.conf

Code: Select all

/home/username/conf/web/nginx.conf
add this inside the location block

Code: Select all

try_files $uri $uri/ /index.php?$args;
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: How Do I Add Permalinks Support on SSL with Nginx?
  • Quote

Post by mehargags » Fri Oct 21, 2016 8:13 am

Do you even realize that the question you asked had NOTHING TO DO with VestaCP ? It is a dumb-down NGINX question and before going in for Nginx + PHP-FPM setup you should have done your research and known the fact how to parse your Apache htaccess rules which are NOT honored by Nginx.

Many of us devote our valuable work hours... but sometimes things get a hit or a miss.
Being rude on any public forum is going to get you nothing out... Its a community service.! Research
Top

lotusming
Posts: 16
Joined: Fri Jun 10, 2016 6:34 pm

Re: How Do I Add Permalinks Support on SSL with Nginx?
  • Quote

Post by lotusming » Fri Oct 21, 2016 2:46 pm

The only reason you answered bud was because of the first line in my post. Information is not organized properly here so I will ignore your "do research" plug. VestaCP changes many things from how it's normally done in nginx hence the need to ask!

Now since you're on your valuable work hours, you can skip this reply as well and "have a good day".
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: How Do I Add Permalinks Support on SSL with Nginx?
  • Quote

Post by mehargags » Fri Oct 21, 2016 5:13 pm

You are welcome to post suggestions, the community needs your contribution...in whatever aspect you feel - though with some positive attitude. Words do matter, they make or break worlds!
Top


Post Reply
  • Print view

5 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password