一切都将定向到我已设置的子域。
我的虚拟主机文件中肯定有问题,因为我很确定DNS设置正确。
这是主站点的虚拟主机文件:
# domain: mydomain.com
# public: /home/myusername/public/mydomain.com/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName www.mydomain.com
ServerAlias mydomain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/myusername/public/mydomain.com/public
<Directory /home/myusername/public/mydomain.com/public>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# Log file locations
LogLevel debug
ErrorLog /home/myusername/public/mydomain.com/log/error.log
CustomLog /home/myusername/public/mydomain.com/log/access.log combined
</VirtualHost>
这是子域的虚拟主机文件:
# domain: sub.mydomain.com
# public: /home/myusername/public/sub.mydomain.com/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName sub.mydomain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/myusername/public/sub.mydomain.com/public
<Directory /home/myusername/public/sub.mydomain.com/public>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# Log file locations
LogLevel warn
ErrorLog /home/myusername/public/sub.mydomain.com/log/error.log
CustomLog /home/myusername/public/sub.mydomain.com/log/access.log combined
</VirtualHost>
对于虚拟主机,您需要此:
<VirtualHost sub.mydomain.com:80>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句