• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Plesk Onyx & nginx: How to define separate settings for HTTP and HTTPS

B_P

Regular Pleskian
Hi all,

while switching to a new system (Ubuntu 12.04 ->16.04) and Plesk Onyx (from 12.5), I see that nginx was enabled automatically. Since this seems to be an interesting combination, I started experimenting...

Now the first question that I have: For Apache, I can define for each website/subdomain custom settings for Apache & nginx. For Apache, these can be different for HTTP and HTTPS. However, for nginx there is only one field. How can I define different settings for HTTP and HTTPS?

- This is for instance necessary for HTTP to HTTPS redirects (where the redirect is only required on the HTTP port). Here separate configuration settings would be helpful to prevent the execution of additional regular expressions and if statements...
 
Hi B_P,
surprise, surprise... Plesk may solve this for you: => HOME > Domains > (sub)domain > Hosting Settings >


Well, I have a special case which I use to facilitate accessing the plesk panel:
- The Plesk panel is located at https://plesk.domain.tld:8443/ and is expected to use a Let's encrypt certificate
- The server also hosts domain.tld
- Any access to plesk.domain.com (HTTP, HTTPS on regular ports) should be redirected to the Plesk URL
- ... except those which are required for the validation of the Let's encrypt certificates (/.well-known/acme-challenge/.*)

To simplify the access, I created a subdomain plesk.domain.tld. Now the idea is the following (works with Apache and Plesk 12.5):
a) When accessing http://plesk.domain.tld/ (or any location on this subdomain except those for Let's encrypt), I get redirected to http://plesk.domain.tld/:
RedirectMatch 301 ^(?!/\.well-known/acme-challenge/).* https://plesk.domain.tld$0 (additional HTTP directives used with Plesk 12.5)
b) When accessing https://plesk.domain.tld (or any location on this subdomain), I get redirected to https://plesk.domain.tld:8443/
Redirect permanent / https://plesk.domain.tld:8443/ (additional HTTPS directives used with Plesk 12.5)

How would this work with nginx?

In addition, I assume that there are other cases where different settings may be required for HTTP and HTTPS...
 
Hi B_P,

am I correct, that you opened the thread, because of Let's Encrypt and the desire to secure the server - hostname with a Let's Encrypt certificate? Well good news... pls. visit: => #5


If you desire to redirect visitors from any URL ( of your hosted domains on your server ) with the port specification ":8443" to an URL of your choice ( i.e. https://plesk.YOUR-DOMAIN.COM:8443 ), you would follow:



Could you pls. post the corresponding log from Let's Encrypt, if you experience any issues, when trying to create a certificate for your (sub)domain? You should NOT need any apache ( or nginx ) rewrites, when you use the Plesk - Let's Encrypt - Extension. ;)
 
Back
Top