• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Plesk 11.5, selected site on default IP via HTTPS -- problem

Maxim Makarenko

New Pleskian
Hello,

I have Plesk 11.5 installed on my server. There are about 30 sites on the same shared IP address. I need to set up a site to be accessible via https://<ip-address-of-the-server> .

According to the documentation I went to Setting -> IP Addresses and selected the desired site from the drop down. Now http://<ip-address-of-the-server> (note, 80th port) works like a charm. Unfortunately https:// displays only the first page of the selected site; all CSS, JS and other files are not found (404).

I did some research and found that Nginx forwards the requests to Apache for all the PHP files and tries to handle all the static files by itself (what is expected and correct). But it looks like that there is no special configuration for nginx which would specify where to get these static files for the IP address, and Nginx just uses the first loaded config (started from b in my case).

I temporary resolved this issue by modifying the last_nginx.conf for the desired domain this way:

listen XX.XX.XX.XX:443 default_server ssl;

Note I added "default_server" directive. Of course it would be erased on each reconfiguration of the config files, but as for now I do not see how I can put it in custom nginx.conf or on the server servel level. I reckon Plesk should include the directive in the file the same way as it produces last_httpd_ip_default.conf Apache config for the selected domain. It looks to be an easy fix on the template level, may be I will do it later, but for now this is just the bug report.
 
Fast fix:

1. Create the folder for custom templates:
mkdir /usr/local/psa/admin/conf/templates/custom/domain

2. Copy the original template as the basis for the custom templae:
cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/

3. Modify the line with "listen" directive this way:

listen <?php echo $OPT['ipAddress']->escapedAddress . ':' . $OPT['frontendPort'] . (($OPT['ipAddress']->defaultDomainId == $VAR->domain->id && $OPT['ssl']) ? ' default_server ' : '' ) . ($OPT['ssl'] ? ' ssl' : '') ?>;

4. Reconfigure:
/usr/local/psa/admin/bin/httpdmng --reconfigure-all

An alternative would be to set up default_server for HTTPS/443 in /etc/nginx/plesk.conf.d/server.conf, but this is a pain to put correct certificates settings into the file. So I decided to do it on the domains level.

I tested the fix and it works perfectly.
 
Back
Top