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:
Further down in the file, you’ll find another similar block. Update it as well:
Make sure to remove the --> and <-- markers, and replace "YOUR-SECOND-IP" with the actual IP you’re adding.
Final Step:
Restart NGINX with
and regenerate all domain configurations on your Plesk server by running the following command via SSH:
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
Code:
plesk repair web -y