我有一个Apache配置文件。它几乎正常工作。但是有两个问题。首先是有大量重复的代码,我不知道如何删除,因为我是Apache的新手。第二个问题是网站http://club.ladby.ru/。
VirtualDocumentRoot /var/www/club.ladby.ru/public/
没有显示正确的网站。
继续打开这个:VirtualDocumentRoot /var/www/lovecakes.ru/public/
。
我希望能够打开像* .ladby.ru和* .lovecakes.ru这样的网站,除了主要网站ladby.ru和lovecakes.ru。
这是一个完整的文件:
<VirtualHost *:80>
ServerAlias www.lovecakes.ru
UseCanonicalName Off
VirtualDocumentRoot /var/www/lovecakes.ru/public/
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
<Directory />
Options FollowSymLinks MultiViews
AllowOverride all
</Directory>
<Directory /var/www/>
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 all
Options +ExecCGI +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAlias *.lovecakes.ru
UseCanonicalName Off
VirtualDocumentRoot /var/www/%0/public/
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
<Directory />
Options FollowSymLinks MultiViews
AllowOverride all
</Directory>
<Directory /var/www/>
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 all
Options +ExecCGI +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAlias www.ladby.ru
UseCanonicalName Off
VirtualDocumentRoot /var/www/ladby.ru/public
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
<Directory />
Options FollowSymLinks MultiViews
AllowOverride all
</Directory>
<Directory /var/www/>
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 all
Options +ExecCGI +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAlias ladby.ru
UseCanonicalName Off
VirtualDocumentRoot /var/www/ladby.ru/public/
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
<Directory />
Options FollowSymLinks MultiViews
AllowOverride all
</Directory>
<Directory /var/www/>
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 all
Options +ExecCGI +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAlias club.ladby.ru
UseCanonicalName Off
VirtualDocumentRoot /var/www/club.ladby.ru/public/
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
<Directory />
Options FollowSymLinks MultiViews
AllowOverride all
</Directory>
<Directory /var/www/>
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 all
Options +ExecCGI +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
答案 0 :(得分:0)
<VirtualHost *:80>
ServerName www.lovecakes.ru
DocumentRoot /var/www/lovecakes.ru/public/
</VirtualHost>
<VirtualHost *:80>
ServerName galina.lovecakes.ru
DocumentRoot /var/www/galina.lovecakes.ru/public/
</VirtualHost>
<VirtualHost *:80>
ServerName www.ladby.ru
DocumentRoot /var/www/ladby.ru/public/
</VirtualHost>
<VirtualHost *:80>
ServerName ladby.ru
DocumentRoot /var/www/ladby.ru/public/
</VirtualHost>
<VirtualHost *:80>
ServerName club.ladby.ru
DocumentRoot /var/www/club.ladby.ru/public/
</VirtualHost>
我删除了所有内容并使其更加简单。有用。