[英]In Linux configuring virtual host and localhost redirecting to the xampp folder
I have problem with vertual host in linux . 我在linux中的vertual主机有问题。 Port number is opened and i have write the code in httpd-vhosts.conf file.
端口号已打开,我已在httpd-vhosts.conf文件中编写代码。
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:- 方法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>
Problem is this is redirecting to xampp folder. 问题是这是重定向到xampp文件夹。
After many trails i have find a answer for this virtual host configuration. 在许多路径之后,我找到了这个虚拟主机配置的答案。
I have done the small mistake, that is i have not enable the virtual host config file in httpd.conf file. 我做了一个小错误,就是我没有在httpd.conf文件中启用虚拟主机配置文件。
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
I have enable this one and configured virtual host in httpd-vhosts.conf file like 我在httpd-vhosts.conf文件中启用了这个并配置了虚拟主机
<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's working fine.. 之后重新启动xampp服务器,现在它正常工作..
Hope this helps to others. 希望这对其他人有帮助。
<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 are receiving another error when you access localhost:8300, like permission denied. 应该工作,除非您在访问localhost时收到另一个错误:8300,如同拒绝权限。 You'll also need to make sure
Listen 8300
is present in your httpd.conf. 您还需要确保httpd.conf中存在
Listen 8300
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.