本地主机的子域不起作用。 Apache 2.4.25 (Debian) 服务器位于 subdomain.localhost 端口 80

本地主机的子域不起作用。 Apache 2.4.25 (Debian) 服务器位于 subdomain.localhost 端口 80

Apache 2.4.25 (Debian) 服务器端口 80:本地主机的子域无法正常工作

本地主机在职的。

本地主机/站点1也在工作。

site1.localhost 是不是在职的

改变了文档根目录/var/www/html/home/me/public_html

在public_html目录中,我创建了两个目录,site1,site2

public_html目录具有权限:

rwxr-xr-x  2 me me

配置:

/etc/hosts
127.0.0.1       localhost
127.0.1.1       debian
127.0.0.1       site1.localhost

/etc/apache2/sites-enabled/000-default.conf
    <Directory /home/me/public_html>
        Options Indexes FollowSymLinks
        AllowOverride none
        Order deny,allow
        Allow from all
        Require all granted          
    </Directory>

/etc/apache2/sites-available/site1.conf
<VirtualHost *:80>
        ServerName site1.localhost
        DocumentRoot /home/me/public_html/site1
</VirtualHost>

ste1.localhost 返回:

403 禁止:Apache 2.4.25 (Debian) 服务器位于site1.localhost80端口

$ sudo apache2ctl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost site1.localhost (/etc/apache2/sites-enabled/site1.conf:1)
         port 80 namevhost site2.localhost (/etc/apache2/sites-enabled/site2.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex proxy: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default 
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="me" id=1000
Group: name="www-data" id=33


$ ls -l /etc/apache2/sites-available
total 20
-rw-r--r-- 1 root root 1583 Sep 24 23:54 000-default.conf
-rw-r--r-- 1 root root 6338 Apr  5 14:32 default-ssl.conf
-rw-r--r-- 1 root root  103 Sep 24 11:03 site1.conf
-rw-r--r-- 1 root root  117 Sep 23 19:31 site2.conf


 $ ls -l /etc/apache2/sites-enabled/
     total 0
    lrwxrwxrwx 1 root root 35 Sep  5 12:13 000-default.conf -> ../sites-available/000-default.conf
    lrwxrwxrwx 1 root root 29 Sep 23 19:49 site1.conf -> ../sites-available/site1.conf
    lrwxrwxrwx 1 root root 29 Sep 23 19:49 site2.conf -> ../sites-available/site2.conf

相关内容