PanamaTimes

Friday, Jan 10, 2025

Multiple IP setup

To assign separate unique IP addresses to different domain names on a Linux hosting server, you need to configure your server's network and web server to bind each domain name to a specific IP address. Here’s how you can achieve this:

---

### **Step 1: Assign Multiple IP Addresses to the Server**
1. **Add IP Addresses to the Network Interface**
   Edit your network configuration file to include the additional IP addresses. For example, on systems using `netplan`, you can edit `/etc/netplan/*.yaml` to add IP addresses like this:
   ```yaml
   network:
     version: 2
     ethernets:
       eth0:
         addresses:
           - 192.168.1.10/24
           - 192.168.1.11/24
           - 192.168.1.12/24
   ```
   Apply the changes:
   ```bash
   sudo netplan apply
   ```

2. **Verify the Configuration**
   Ensure the additional IPs are assigned using:
   ```bash
   ip addr show
   ```

---

### **Step 2: Configure the Web Server**
You need to configure your web server (e.g., Apache or Nginx) to bind each domain name to a specific IP address.

#### **For Apache**
1. Edit your virtual host configuration files, typically located in `/etc/apache2/sites-available/`.
2. Define a virtual host for each domain and bind it to a specific IP:
   ```apache
   <VirtualHost 192.168.1.10:80>
       ServerName domain1.com
       DocumentRoot /var/www/domain1
   </VirtualHost>

   <VirtualHost 192.168.1.11:80>
       ServerName domain2.com
       DocumentRoot /var/www/domain2
   </VirtualHost>
   ```
3. Enable the virtual hosts:
   ```bash
   sudo a2ensite domain1.conf
   sudo a2ensite domain2.conf
   ```
4. Restart Apache:
   ```bash
   sudo systemctl restart apache2
   ```

#### **For Nginx**
1. Edit your server block configuration files, typically located in `/etc/nginx/sites-available/`.
2. Define a server block for each domain and bind it to a specific IP:
   ```nginx
   server {
       listen 192.168.1.10:80;
       server_name domain1.com;
       root /var/www/domain1;
   }

   server {
       listen 192.168.1.11:80;
       server_name domain2.com;
       root /var/www/domain2;
   }
   ```
3. Enable the configurations by creating symbolic links:
   ```bash
   sudo ln -s /etc/nginx/sites-available/domain1 /etc/nginx/sites-enabled/
   sudo ln -s /etc/nginx/sites-available/domain2 /etc/nginx/sites-enabled/
   ```
4. Test and reload Nginx:
   ```bash
   sudo nginx -t
   sudo systemctl reload nginx
   ```

---

### **Step 3: Update DNS Records**
Ensure the DNS records for each domain point to the assigned IP address:
- For `domain1.com`, set the A record to `192.168.1.10`.
- For `domain2.com`, set the A record to `192.168.1.11`.

You can configure this through your domain registrar's DNS management panel.

---

### **Step 4: Test Your Configuration**
Verify that each domain resolves to its specific IP address using tools like `ping` or `curl`:
```bash
ping domain1.com
ping domain2.com
```

---

### **Optional: SSL/TLS Configuration**
If you are using HTTPS, set up SSL certificates for each domain, ensuring they correspond to their unique IP address.

Newsletter

Related Articles

PanamaTimes
0:00
0:00
Close
California Wildfires Set to Become Costliest in U.S. History
Chief Justice Roberts Warns Against Threats to Judicial Independence
Generation Z Faces Scrutiny Over Workplace Readiness
Democrats Call on Biden to Protect Controversial Temporary Protected Status Program
Trinidad and Tobago Declares State of Emergency as Murder Rates Surge
Migrant Children Abandoned at U.S.-Mexico Border
The Closure of the Global Engagement Center: Controversy, Claims, and Conclusions
The American Democrats Party Strives to Rise from the Ashes
Trump Nominates Kevin Marino Cabrera as Ambassador to Panama Amid Canal Dispute
Texas Congresswoman Kay Granger Located in Nursing Home Following Six Months of Inactivity
A large group of unauthorized migrants is traveling through Mexico with the aim of reaching the USA before Trump assumes office.
A Democrat Congresswoman with blue and black hair is having a breakdown over "President Musk."
Argentina Defies Predictions with Record $17 Billion Trade Surplus, But Is the Growth Sustainable?
Disney's High Seas Gamble: Navigating the Waters of Cruise Expansion
The Surprising Impact of Extreme Heat on Mexico's Youth
Polarization: The Word That Unites a Divided Era
Exoneration in the Subway: The Complexities of Self-Defense and Public Safety
The Tragic Passing of UnitedHealthcare CEO Highlights Corporate Security Challenges
Global Developments: Violence in Sinaloa, Political Chaos in the Bahamas, Venezuelan Voting Disputes, and a Major UK Drug Bust
OpenAI and Anduril: Charting AI's Path in Modern Warfare
The Pardon of Hunter Biden: A Symbol of Hypocrisy
Biden Crafted the Strategy Used by Trump
South Korea's Democracy Tested: President Yoon’s Martial Law Reversal Sparks Political Reckoning
Seoul Crisis: Yoon Suk Yeol's Martial Law Blunder Triggers Political Upheaval
Generative AI's Limited Impact on Elections Highlighted by Meta
France at the Precipice: Barnier’s Administration Confronts Unprecedented No-Confidence Vote
Jaguar Unveils Electric Concept Car, Type 00
White House Defends Presidential Pardon of Hunter Biden
xAI by Elon Musk: Transforming Ambition with a $50 Billion Valuation
President-elect Donald Trump, has announced on Truth Social that Kashyap "Kash" Patel, will be the next Director of the FBI
A Historic Milestone or Risky Precedent? The Assisted Dying Bill Splits both Parliament and the Nation in England and Wales
Trump's Tariff Threat Looms Large as Trudeau Heads to Mar-a-Lago for Talks
Canada's Oil Industry Faces Uncertainty Amidst Trump's Tariff Threat
World Court to Assess Global Legal Responsibilities on Climate Change
What the Pink Elephant Test Reveals About Thought Control
Trudeau Visits Trump in Florida Amid Rising Tariff Concerns
Is Elon Musk the Unofficial President of America?
Impact of Proposed US Tariffs on Canadian Oil Exports
U.S. policymakers face a contentious debate over whether to engage with Nicolás Maduro's regime in Venezuela.
COP29's Carbon Trading Deal Faces Major Criticisms
Indian Diplomats in Canada Monitored: Government Raises Alarm
Putin Warns Trump of Ongoing Safety Concerns
Claudia Sheinbaum Challenges Trump's Migration Claims
Insights from Dostoevsky: The Impact of Self-Deception
Trump Administration Nominees Face Threats, FBI Confirms
Elon Musk Criticizes Fighter Jets, Advocates for Drone Warfare
Kim Kardashian's Social Media Activity Fuels Political Speculation
An Examination of AI's Influence on Future Work and Life
Tulsi Gabbard's Contentious Nomination for Director of National Intelligence
$100,000 Trump Watch Faces Slow Sales
×