I have a VPS with apache2 installed and I would like to access some PHP projects without a domain name just with the IP address. For example:
http://162.243.93.2
" http://162.243.93.216/info.php then /var/www/html/info.php is opened "
I am assuming this already works (If not, uncomment the ServerAlias
line shown in the conf below)
You now want to map
http://162.243.93.216/projecta/
to /var/www/projecta
http://162.243.93.216/projectb/
to /var/www/projectb
For this you need to use the Apache Alias
directive.
000-default.conf
file to:
# ServerAlias 162.243.93.216
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
Alias /projecta /var/www/projecta
Alias /projectb /var/www/projectb
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined