2

我需要使用apache 2.0、CentOS 6.4、PageSpeed+Apc在 Web 服务器上创建子域。我没有 DNS 服务器。我需要使用虚拟主机。我的代码:

NameVirtualHost xx.xx.xx.xx     
<VirtualHost xx.xx.xx.xx>
    ServerName www.sub.domain.com
    ServerAlias sub.domain.com
    DocumentRoot /var/www/html/sub
</VirtualHost>
<VirtualHost xx.xx.xx.xx>
    ServerName www.domain.com
    ServerAlias domain.com
    DocumentRoot /var/www/html
</VirtualHost>

我已将此代码放入:/etc/httpd/conf.d/somename.conf但它不起作用。同样在:httpd.conf,不起作用。

4

2 回答 2

1

我正在执行以下操作:

<VirtualHost *:80>
 DocumentRoot "/storage/www/domain.com"
 ServerName domain.com
 ServerAlias www.domain.com
 CustomLog /var/log/httpd/access_domain.com_log combined
 ErrorLog /var/log/httpd/error_domain.com_log
</VirtualHost>
于 2014-01-21T20:51:10.280 回答
0

对我来说它看起来像这样

<Directory /var/www/xxxxx/data/www/domain.com>
    Options -Includes +ExecCGI
    php_admin_value open_basedir "/var/www/xxxxxxxxx/data:."
    php_admin_flag engine on
</Directory>

<VirtualHost 155.155.255.152:80 >
    ServerName domain.com
    CustomLog /dev/null combined
    DocumentRoot /var/www/xxxxxxxxx/data/www/domain.com
    ErrorLog /dev/null
    ServerAdmin webmaster@domain.com
    ServerAlias www.domain.com
    SuexecUserGroup xxxxxxxxx xxxxxxxxx
    ScriptAlias /cgi-bin/ /var/www/xxxxxxxxx/data/www/domain.com/cgi-bin/
    AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
    AddType application/x-httpd-php-source .phps
    php_admin_value open_basedir "/var/www/xxxxxxxxx/data:."
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f webmaster@domain.com"
    php_admin_value upload_tmp_dir "/var/www/xxxxxxxxx/data/mod-tmp"
    php_admin_value session.save_path "/var/www/xxxxxxxxx/data/mod-tmp"
</VirtualHost>

<VirtualHost 155.155.255.152:443 >
    SSLCertificateFile /var/www/httpd-cert/xxxxxxxxx/domain.crt
    SSLCertificateKeyFile /var/www/httpd-cert/xxxxxxxxx/domain.key
    SSLEngine on
    ServerName domain.com
    CustomLog /dev/null combined
    DocumentRoot /var/www/xxxxxxxxx/data/www/domain.com
    ErrorLog /dev/null
    ServerAdmin webmaster@domain.com
    ServerAlias www.domain.com
    SuexecUserGroup xxxxxxxxx xxxxxxxxx
    ScriptAlias /cgi-bin/ /var/www/xxxxxxxxx/data/www/domain.com/cgi-bin/
    AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
    AddType application/x-httpd-php-source .phps
    php_admin_value open_basedir "/var/www/xxxxxxxxx/data:."
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f webmaster@domain.com"
    php_admin_value upload_tmp_dir "/var/www/xxxxxxxxx/data/mod-tmp"
    php_admin_value session.save_path "/var/www/xxxxxxxxx/data/mod-tmp"
</VirtualHost>
于 2013-05-30T19:08:48.220 回答