Reputation: 109
I have installed on my machine the following settings:
But I have two web applications running on my server they are:
I recently had to use ProxyReverso to be able to redirect the Ethercalc to 80. whereupon my setup:
<VirtualHost *:80>
ProxyPreserveHost On
ServerName localhost
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
ProxyRequests Off
ProxyPass / http://192.168.1.32:8082/
ProxyPassReverse / http://192.168.1.32:8082/
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
<Location /teste>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
AuthUserFile /etc/apache2/site1/.htpasswd
AuthName "Password Protected Area"
AuthType Basic
Require valid-user
</Location>
<Location /teste/edit>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Deny from all
Allow from 192.168.12.31
</Location>
<Directory /var/www/phpipam>
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
When access my localhost, it redirects to the Ethercalc, but I would like that when I type for example: https://localhost:81, I am redirected to the Phpipam.
Does anyone have any idea if this is possible?
Upvotes: 2
Views: 1448
Reputation: 2195
You can using two virtual hosts, but you do not have to use the portnumber for it. You have normally two IP addresses at your disposal, namely 127.0.0.1 and 127.0.1.1. Use one for the PHPiPam and the other for EtherCalc. Then you do not have to use a proxy.
Now are you redirecting all your requests redirecting to Ehtercalc. You only have to do that for requests that start with for instance www.ethercalc.te.
You set both domains (www.ethercalc.te and www.phpipam.te) in your /etc/hosts file, create two virtual hosts for them, enable them and you are ready to go.
In Apache you have a port.conf. In that file can you add port 81 as a port on which Apache should listen. You can create a virtual host for port 81 and then map that to your PHPipam server.
In my file /etc/hosts have I set the first entry to: 127.0.0.1 localhost www.tandt.lb tandt.lb
This is the virtual host:
<VirtualHost www.tandt.lb:80>
ServerName www.tandt.lb
ServerAlias tandt.lb *.tandt.lb
ServerAdmin [email protected]
DocumentRoot /var/www/Websites/TestAndTools
RewriteEngine On
RewriteOptions Inherit
<Directory /var/www/Websites/TestAndTools>
Options -Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/tandt/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/tandt/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Make sure to create the custom log directories before enabling this virtual directory using a2ensite .... (your filename in the directory /etc/apache/sites-available).
Upvotes: 1