localhostのサブドメインが機能しません。 Apache 2.4.25(Debian)サーバーはsubdomain.localhostポート80にあります。

localhostのサブドメインが機能しません。 Apache 2.4.25(Debian)サーバーはsubdomain.localhostポート80にあります。

Apache 2.4.25(Debian)サーバーポート80:localhostのサブドメインが正しく機能しません。

ローカルホストはい布材。

ローカルホスト/サイト1はいまた働いています。

site1.localhostはいいえ布材

変更ドキュメントルート/var/www/htmlから/home/me/public_html

public_htmlディレクトリにsite1、site2という2つのディレクトリを作成しました。

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.localhostポート80

$ 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

ベストアンサー1

おすすめ記事