当前位置:   article > 正文

Apache端口映射_通过apache的httpd映射端口号

通过apache的httpd映射端口号

网站目录为wamp\www\pingce 通过ip访问,访问方式为http://127.0.0.1/pingce/public/index.php,因为用户觉得访问的url太长,想直接通过http://127.0.0.1进行访问。

解决方案:

1. 修改httpd.conf文件

C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf

  1. # Virtual hosts
  2. #Include conf/extra/httpd-vhosts.conf

修改为:

  1. # Virtual hosts
  2. Include conf/extra/httpd-vhosts.conf

2. 修改httpd-vhosts.conf文件

C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf

  1. <VirtualHost *:80>
  2. ServerAdmin webmaster@dummy-host.example.com
  3. DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
  4. ServerName dummy-host.example.com
  5. ServerAlias www.dummy-host.example.com
  6. ErrorLog "logs/dummy-host.example.com-error.log"
  7. CustomLog "logs/dummy-host.example.com-access.log" common
  8. </VirtualHost>
  9. <VirtualHost *:80>
  10. ServerAdmin webmaster@dummy-host2.example.com
  11. DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
  12. ServerName dummy-host2.example.com
  13. ErrorLog "logs/dummy-host2.example.com-error.log"
  14. CustomLog "logs/dummy-host2.example.com-access.log" common
  15. </VirtualHost>

修改为:

  1. <VirtualHost *:80>
  2. ServerAdmin localhost
  3. DocumentRoot "D:/wamp/www/pingce/public"
  4. ServerName localhost
  5. ServerAlias localhost
  6. ErrorLog "logs/dummy-host.example.com-error.log"
  7. CustomLog "logs/dummy-host.example.com-access.log" common
  8. </VirtualHost>

或者修改为

  1. NameVirtualHost *:80
  2. <VirtualHost *:80>
  3. DocumentRoot "D:/wamp/www/pingce/public"
  4. ServerName localhost
  5. <Directory "D:/wamp/www/pingce/public"
  6. # Options Indexes FollowSymLinks
  7. Options all
  8. AllowOverride all
  9. Order Deny,Allow
  10. Allow from all
  11. </Directory>
  12. </VirtualHost>

如果是将本地的网站移植到另一台未装开发Laravel开发环境(composer,vagrant等),并已经修改了.htaccess文件,此时会出现的问题。


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/300344
推荐阅读
相关标签
  

闽ICP备14008679号