Apache 2.2 Single IP multi-domain virtual host access settings for different directories

Source: Internet
Author: User

First edit httpd.conf

Comment out the following places

#ServerAdmin [email protected]

#ServerName www.example.com:80

#DocumentRoot "/usr/local/apache2/htdocs"

#<directory/>
# Options FollowSymLinks
# allowoverride None
# Order Deny,allow
# Deny from all
#</directory>

#<directory "/usr/local/apache2/htdocs" >
#
# Possible values for the Options directive is "None", "all",
# or any combination of:
# Indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
# Note that "MultiViews" must is named *explicitly*---"Options all"
# doesn ' t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
# Options Indexes followsymlinks

#
# AllowOverride Controls What directives is placed in. htaccess files.
# It can be ' all ', ' None ', or any combination of the keywords:
# Options FileInfo authconfig Limit
#
# allowoverride None

#
# Controls who can get stuff from the this server.
#
# Order Allow,deny
# Allow from all

#</directory>

Turn on the httpd-vhosts.conf configuration to cancel the comments in the previous include

# Virtual Hosts
Include conf/extra/httpd-vhosts.conf

Configuring the Extra/httpd-vhosts.conf File

Configuration example, how many subwebs there are, configure several

<virtualhost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/A"
    ServerName www.a.com
    #ServerAlias www.dummy-host.example.com
    errorlog "Logs/a-error.log"
    customlog "logs /a-access.log "Common
    <directory"/a ";
        Options Indexes followsymlinks
        allowoverride None
         Order Allow,deny
        allow from all
    </directory>
</virtualhost>

<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/b"
ServerName www.b.com
#ServerAlias www.dummy-host.example.com
Errorlog "Logs/b-error.log"
Customlog "Logs/b-access.log" common
<directory "/b" >
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>

According to the actual need to configure

About directory Permissions

Chown-r www-data:www-data/a

Chmod-r 755/a

Restart Apache to make configuration effective

/etc/init.d/apache2 restart

Apache 2.2 Single IP multi-domain virtual host access settings for different directories

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.