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
#Virtual hosts
#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:
<virtualhost *:80>
ServerAdmin [email protected]
documentroot "D:\wamp\www"
ServerName localhost
Serveralias localhost
Errorlog "Logs/dummy-host.localhost-error.log"
Customlog "Logs/dummy-host.localhost-access.log" common
</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:
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot E:\ProjectRoot\
ServerName test.sallency.com
Errorlog "Logs/dummy-host2.localhost-error.log"
Customlog "Logs/dummy-host2.localhost-access.log" common
</VirtualHost>
2. Open the Host file (C:\WINDOWS\system32\drivers\etc\hosts) and add a line of code
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
<directory/>
Options FollowSymLinks
AllowOverride All
Order Deny,allow
Deny from all
</Directory>
Copy the above code, and make the directory modification, put/replace with E:\WebRoot\biuuu, modify the VirtualHost code as follows
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot E:\ProjectRoot\
ServerName test.sallency.com
Errorlog "Logs/dummy-host2.localhost-error.log"
Customlog "Logs/dummy-host2.localhost-access.log" common
<directory E:\ProjectRoot\>
Options FollowSymLinks
AllowOverride All
Order Deny,allow
Deny from all
</Directory>
</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