Host same server but two different domain.

ritesha year ago

I have hosted traccar in same server. but 2 different domain.
I have build traccar ui. and hosted on var/www/html/new_traccar/

my new domain: gps.new_doamin.com
my old domain: gps.old_domain.com

<VirtualHost *:80>
    ServerName gps.new_doamin.com
    DocumentRoot /var/www/html/gps

    <Directory /var/www/html/gps>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/gps.new_doamin-error.log
    CustomLog ${APACHE_LOG_DIR}/gps.new_doamin-access.log combined
</VirtualHost>

error:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> <hr> <address>Apache/2.4.57 (Ubuntu) Server at gps.new_doamin.com Port 443</address> </body></html>

Can you please help me?

Abdullaha year ago

You can use the server Alias directive,
After the ServerName add:

ServerAlias another.website.com

Also you may want to update your options to disable indexes

Options -Indexes +FollowSymLinks +MultiViews

Then check for configuration

~$ apachectl -t

Make sure to enable the site and restart the http server.