On Linux, configure virtual host and localhost redirection to xampp folder
I have a vertical host problem on linux. The port number is open and I wrote the code in the httpd-vhosts.conf file.
Code: -
<VirtualHost *:8300>
ServerAdmin "webmaster@dummy-host2.example.com"
DocumentRoot "/opt/lampp/htdocs/xyz"
ServerName "localhost:8300"
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
method 2: -
<VirtualHost *:8300>
DocumentRoot "/opt/lampp/htdocs/xyz"
ServerName localhost:8300
ServerAlias localhost:8300
<Directory "/opt/lampp/htdocs/xyz">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The problem is it is a redirect to the xampp folder.
+3
source to share
2 answers
<VirtualHost *:8300>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /opt/lampp/htdocs/xyz
ServerName localhost
ErrorLog logs/error.log
CustomLog logs/access.log common
</VirtualHost>
Should work unless you get another error when accessing localhost: 8300, as does the permission. You also need to make sure it is Listen 8300
present in your httpd.conf.
0
source to share
After many trails, I will find the answer for this virtual host configuration.
I made a small mistake, that is, I did not include the virtual host config file in the httpd.conf file .
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
I have included this and configured virtual host in my httpd-vhosts.conf file like
<VirtualHost *:8300>
ServerAdmin "webmaster@dummy-host2.example.com"
DocumentRoot "/opt/lampp/htdocs/xyz"
ServerName "localhost:8300"
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
After that restarted the xampp server, now it works fine.
Hope this helps others.
+2
source to share