简单的问题如何?
现在我有这样的启用主机
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName git.land
DocumentRoot /home/sergey/public_html/git.land/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/sergey/public_html/git.land/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
并在主机中添加了规则
127.0.0.1 git.land
当我进入&#34; http://git.land&#34;它显示正确的方向。但是当我试图进入&#34; http://some.git.land&#34;卡住了。想了很多,然后重定向上一步。页面(没有子域名)。
我想将子域添加到localhost进行测试,但我不知道应该使用它。基本的东西,我知道,我尝试但它什么都没有。
我也可以(也许)以某种方式从.htaccess中更改它(我搜索过并发现人们使用它们来获取子域名而不在主机中进行任何配置。)
答案 0 :(得分:0)
此配置文件解决了问题
<VirtualHost *:80>
DocumentRoot /home/sergey/public_html/git.land/public_html
ServerName other.land
ServerAlias *.land
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName land
DocumentRoot /home/sergey/public_html/git.land/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/sergey/public_html/git.land/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
仅在主机中设置所有案例(我的意思是子域名)时才有效。