apache 具有指定端口号的xampp无法与virtualhost一起工作

zhte4eai  于 2023-01-21  发布在  Apache
关注(0)|答案(2)|浏览(128)

我正在尝试为xampp项目创建本地域名
但是dns无法解析,无法正确重定向。
/主机/等

127.0.0.1:8081      mydomainname.test

虚拟主机

<VirtualHost *:8081>
    DocumentRoot "C:/xampp/htdocs/sam"
    ServerName mydomainname.test
    ServerAlias mydomainname.test
    <Directory "C:/xampp/htdocs/sam">
    Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order Deny,Allow
        Allow from all
    Options All
       Require all granted
    </Directory>
</VirtualHost>
gv8xihay

gv8xihay1#

稍微修改一下文件

Listen 8081

<VirtualHost *:8081>
    DocumentRoot "C:/xampp/htdocs/sam"
    ServerName mydomainname.test
    ServerAlias mydomainname.test
    <Directory "C:/xampp/htdocs/sam">
    Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order Deny,Allow
        Allow from all
    Options All
       Require all granted
    </Directory>
</VirtualHost>

在此阅读更多信息:www.example.comhttps://httpd.apache.org/docs/trunk/vhosts/examples.html#port

bn31dyow

bn31dyow2#

它是/etc/hosts。它不接受端口,应该如下所示:mydomainname.test 127.0.0.1

相关问题