apache/wampserver配置虚拟主机、多站点端口、允许通过ip访问

369次阅读
没有评论

虽然经常配置这个,但有时一着急想不起来,这里做个记录

步骤:

  1. 监听本网络本主机の端口 (Listen 0.0.0.0:端口号)
  2. 添加虚拟主机 VirtualHost
  3. 配置目录访问权限(Require local 改为 Require all granted)
  4. 重启apache

上面这4项缺一不可

例如我要在ip:8068访问应用,则需在apacheのhttpd.conf里添加如下配置

Listen 0.0.0.0:8068

<VirtualHost *:8068>
    ServerName localhost
    ServerAlias localhost
 
    # If you use Apache version below 2.4.9 you must consider update or use this instead
    # ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/public/$1

    # If you run your Symfony application on a subpath of your document root, the
    # regular expression must be changed accordingly:
    # ProxyPassMatch ^/path-to-app/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/public/$1

    DocumentRoot E:/wamp64/www/zmy
    <Directory E:/wamp64/www/zmy>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

        FallbackResource /index.php
    </Directory>
 
    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory E:/wamp64/www/zzResourcesAdmin>
    #     Options FollowSymlinks
    # </Directory>
 
</VirtualHost>

附:

  1. 127.0.0.1和0.0.0.0地址の区别   https://zhuanlan.zhihu.com/p/72988255
facingscreen
版权声明:本站原创文章,由 facingscreen2022-08-12发表,共计1028字。
转载说明:本文为搜栈网原创文章,除特殊说明外皆由CC-4.0协议发布,转载请注明出处,如有帮助欢迎打赏。
评论(没有评论)
验证码