• 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.

Input How to use Multiple IP's for 1 Domain [IMPORTANT FEATURE THAT'S MISSING NATIVELY]

boostedhost

New Pleskian
Server operating system version
Ubuntu 20 & 22
Plesk version and microupdate number
18
Assigning two different IPs to one website is absolutely possible. Let me explain how, as it took me quite a bit of headache to figure this out.

Step 1:
Add the secondary IP to your Plesk server, but don't assign it to any websites. You don’t need to associate it directly with any domain.

Step 2:
FTP into your server and navigate to /opt/psa/admin/conf/templates/default/domain. Open the nginxDomainVirtualHost.php file.

In this file, you’ll see a lot of code, but don’t worry—you only need to add four lines. Here's what to add:

PHP:
server {
<?php if ($OPT['ssl'] && $OPT['http3']) : ?>
listen <?php echo $OPT['ipAddress']->escapedAddress . ':' . $OPT['frontendPort'] ?> quic;


--->listen YOUR SECOND IP:<?php echo $OPT['frontendPort'] ?> quic; <---


add_header Alt-Svc <?php echo '\'h3=":' . $OPT['frontendPort'] . '"; ma=86400\'' ?>;
<?php endif; ?>
listen <?php echo $OPT['ipAddress']->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;


---->listen YOUR-SECOND-IP:<?php echo $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>; <---


<?php if ($OPT['ssl'] && $OPT['http2']) : ?>
http2 on;
<?php endif; ?>

Further down in the file, you’ll find another similar block. Update it as well:

PHP:
server {
<?php if ($OPT['ssl'] && $OPT['http3']) : ?>
listen <?php echo $OPT['ipAddress']->escapedAddress . ':' . $OPT['frontendPort'] . ' quic' . ($OPT['default'] ?  ' reuseport' : '') ?>;

--->listen YOUR-SECOND-IP:<?php echo $OPT['frontendPort'] ?> quic; <------

add_header Alt-Svc <?php echo '\'h3=":' . $OPT['frontendPort'] . '"; ma=86400\'' ?>;
<?php endif; ?>
listen <?php echo $OPT['ipAddress']->escapedAddress . ':' . $OPT['frontendPort'] .
($OPT['default'] ? ' default_server' : '') . ($OPT['ssl'] ? ' ssl' : '') ?>;

---->listen YOUR-SECOND-IP:<?php echo $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>; <----

<?php if ($OPT['ssl'] && $OPT['http2']) : ?>
http2 on;
<?php endif; ?>

Make sure to remove the --> and <-- markers, and replace "YOUR-SECOND-IP" with the actual IP you’re adding.

Final Step:
Restart NGINX with
Code:
systemctl restart nginx
and regenerate all domain configurations on your Plesk server by running the following command via SSH:
Code:
plesk repair web -y
 
Please do not edit the default templates directly because they WILL get overwritten. Instead, the best way to edit it would be to to make a copy of the template you want to edit (nginxDomainVirtualHost.php in this case) to /usr/local/psa/admin/conf/templates/custom (so in your case, you'll want to copy /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php to /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php)

You can refer to Changing Virtual Hosts Settings Using Configuration Templates for how to properly edit the templates to further customize it to your needs.
 
Back
Top