Apache configures multi-site--403 errors, home directories and sub-site directory issues

Source: Internet
Author: User
Tags php development environment 403 forbidden error

2, Includeoptional conf.d/*.conf

Note that PHP does not parse the module that did not introduce PHP, this is the introduction of a number of module servers, including PHP, MySQL

3, remember to configure the default IP access path and permissions, usually to a welcome page, or to phpadmin with

http.conf# Apche itself cannot parse PHP into a module server such as MySQL and PHP includeoptional conf.d/*.conf# introduce the virtual machine configuration directory includeoptional sites-available /*.CONF # Configuring Access paths for IP default directories
<directory "/var/www" >options followsymlinksallowoverride allrequire all granted</directory>< VirtualHost *:80>serveradmin [Email protected]documentroot "/var/www" ServerName "47.94.240.42" errorlog "logs/ Dummy-host3.example.com-error_log "Customlog" Logs/dummy-host3.example.com-access_log "common</VirtualHost> sites-available

<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/a.santifuture.cn"
ServerName a.santifuture.cn
Errorlog "Logs/dummy-host3.example.com-error_log"
Customlog "Logs/dummy-host3.example.com-access_log" common
</VirtualHost>

PHP Intermediate article Apache configuration httpd-vhosts Virtual Host summary and considerations

Often use Apache virtual host for development and testing, but every time you need to configure the virtual host is the habitual CTRL + C and CTRL + V, this time because of the reload system, you need to configure a new PHP development environment Virtual host, So summarize the APACEH configuration httpd-vhosts virtual Host use methods and procedures, easy to find and use.

Development environment: WAMP
Website: http://www.wampserver.com/en/

Instance one, Apaceh configuring the localhost virtual host step
1, open the Apache directory with Notepad httpd.conf file (e.g. D:\wamp\bin\apache\apache2.2.8\httpd.conf), find the following module

    1. #Virtual hosts

    2. #Include conf/extra/httpd-vhosts.conf

Remove the previous # so that the Httpd-vhosts virtual host file is turned on. This time restart Wamp environment, unable to open localhost, need to be configured in httpd-vhosts.conf.

2, open the Httpd-vhosts file with Notepad, configure the localhost virtual host, refer to the Httpd-vhosts file in the example, modified as follows:

    1. <virtualhost *:80>

    2. ServerAdmin [email protected]

    3. documentroot "D:\wamp\www"

    4. ServerName localhost

    5. Serveralias localhost

    6. Errorlog "Logs/dummy-host.localhost-error.log"

    7. Customlog "Logs/dummy-host.localhost-access.log" common

    8. </VirtualHost>

Modify the configuration as follows:
DocumentRoot modified to the WWW directory under the local WAMP environment (e.g., D:\wamp\www)
ServerName Change to localhost

3, restart Apache, found that localhost can open normally, configure localhost is relatively simple.

Example two, APACEH configuring test.biuuu.com virtual Host Steps

1, the same way, the replication configuration code is modified as follows:

    1. <virtualhost *:80>

    2. ServerAdmin [email protected]

    3. DocumentRoot E:\ProjectRoot\

    4. ServerName test.sallency.com

    5. Errorlog "Logs/dummy-host2.localhost-error.log"

    6. Customlog "Logs/dummy-host2.localhost-access.log" common

    7. </VirtualHost>

2. Open the Host file (C:\WINDOWS\system32\drivers\etc\hosts) and add a line of code

    1. 127.0.0.1 test.sallency.com

3, open test.sallency.com in the browser, found the following error 403 Forbidden Error
Forbidden you do have permission to access/on the this server.

Analysis: This is mainly the directory access permissions are not set, you need to set access to the directory!

4, open the httpd file and locate the following statement

    1. <directory/>

    2. Options FollowSymLinks

    3. AllowOverride All

    4. Order Deny,allow

    5. Deny from all

    6. </Directory>

Copy the above code, and make the directory modification, put/replace with E:\WebRoot\biuuu, modify the VirtualHost code as follows

    1. <virtualhost *:80>

    2. ServerAdmin [email protected]

    3. DocumentRoot E:\ProjectRoot\

    4. ServerName test.sallency.com

    5. Errorlog "Logs/dummy-host2.localhost-error.log"

    6. Customlog "Logs/dummy-host2.localhost-access.log" common

    7. <directory E:\ProjectRoot\>

    8. Options FollowSymLinks

    9. AllowOverride All

    10. Order Deny,allow

    11. Deny from all

    12. </Directory>

    13. </VirtualHost>

Test found in the browser or not open, prompted as above 403 Forbidden error, modify the deny from all to allow from all

5, restart Apache, virtual host configuration success!

Precautions
1, directory path, such as E:\ProjectRoot\

2, access rights, such as upper deny from all modified to allow from all

3,host file, configure the virtual domain host to point to
4,HTTPD file, open the Include conf/extra/httpd-vhosts.conf module
5,httpd-vhosts files, configuring virtual hosts

6, There may also be a Linux SELinux firewall that causes this, remember

Configuring Httpd-vhosts Virtual Host with APACEH is simple for developers, but very important, for reference only!

Resources:

http://httpd.apache.org/docs/2.2/vhosts/

Http://httpd.apache.org/docs/2.0/vhosts/examples.html

Gu Banxin Note: If fatal error:allowed memory size of 8388608 bytes exhausted error occurs

Modify php.ini Settings Memory_limit = 12M (default 8M)

Or just need to add in your program header: Ini_set ("Memory_limit", "12M");

Original: http://blog.163.com/lgh_2002/blog/static/44017526201182514650248/

Apache configures multi-site--403 errors, home directories and sub-site directory issues

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.