Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Ubuntu 18 Point two domains to same folder

I've a server installed with Ubuntu 18.04 and on that server I've created new host for a new sub-domain:

api.example.com

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName example.com
    ServerAlias api.example.com
    DocumentRoot /var/www/searchcore
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Now I would like now to add another sub-domain "newapi.example.com" and I would like it to point to the same folder of the first domain (/var/www/searchcore).

Any idea how to do it?

Thanks

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The ServerAlias directive accepts one or more names, so you can simply append the name of your new sub-domain to the existing ServerAlias directive like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName example.com
    ServerAlias api.example.com newapi.example.com
    DocumentRoot /var/www/searchcore
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Alternatively, you can also have multiple ServerAlias directives:

    ...    
    ServerAlias api.example.com
    ServerAlias new.example.com
    ...

You might want to check out the docs here: https://httpd.apache.org/docs/2.4/mod/core.html#serveralias

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!