Can be written together or can be written separately
sudo apt-get install apache2 php5
sudo apt-get install libapache2-mod-php5 php5-mysql
Modify Apache2.conf
AddType is related to the Type table, which describes the relationship between extension and file type, such as:
AddType Application/x-x509-ca-cert. CRT
The file that describes the. crt extension is the Application/x-x509-ca-cert type, and in content negotiation, if the client needs to be of type Application/x-x509-ca-cert, the. CRT end of the resource is returned
Note: The content-negotiated resource has a corresponding content-location description in the corresponding header of HTTP, such as:
get/a http/1.1
...
...
content-location:a.php
...
#AddType text/html. shtml
#AddHandler server-parsed. shtml
Another type of dynamic processing is server-parsed, in which the server itself parses the markup in the Web page and changes the tag to the correct HTML identity. Because server-parsed needs to process documents of type text/html, the corresponding. sHTML is defined first as the text/html type.
AddHandler describes what kind of extension to use for processing, which describes the relationship between extension and handler
AddHandler Cgi-script. CGI
ServerName localhost
Refers to how the server resolves localhost to access the server
Eg:servername 127.0.0.1
Eg:servername 192.168.1.1
Eg:servername test.com
This allows the client to access the server via IP domain when accessing the browser
Eg: setting up multiple Web sites-the configuration of virtual hosts
Open http.conf
1,servername 127.0.0.1 modified to ServerName you server IP
2, #NameVirtualHost * modified to "namevirtualhost Your server IP"
3, on the last side of the file has a virtual host format,
#<virtualhost *>
# ServerAdmin [Email][email Protected][/email]
# documentroot/www/httpd/html/minidx.com
# ServerName Minidx.com
# errorlog Logs/minidx.com-error_log
# Customlog Logs/minidx.com-access_log Common
#</virtualhost>
Add to:
<virtualhost Your Server ip>
DocumentRoot usr/local/www/(Default Web site path)
ServerName Your server IP
</VirtualHost>
<virtualhost Your Server ip>
DocumentRoot usr/local/www/minidx.com/(website path)
ServerName minidx.com (your domain)
</VirtualHost>
<virtualhost Your Server ip>
DocumentRoot usr/local/www/ntt.cc/(website path)
ServerName ntt.cc (Your second domain)
</VirtualHost>
Http://www.php100.com/html/webkaifa/apache/2009/0418/1192.html
Lamp environment Installation and Apache configuration