简体   繁体   中英

xampp with a specified port number not working with virtualhost

I am trying to create a local domain name for my xampp project

But the dns is not resolving it is not redirecting correctly.

/hosts/etc

127.0.0.1:8081      mydomainname.test

virtualhost

<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>

Change the file a little

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>

Read more here: https://httpd.apache.org/docs/trunk/vhosts/examples.html#port

It's /etc/hosts . And it does not accept ports and should look like: mydomainname.test 127.0.0.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM