CentOS System Installation Configure Apache Web server

Source: Internet
Author: User
Tags install php centos

Demo Environment:
Linux CentOS 6.3 X64 Apache

First, the installation of Apache and related components

1, with the root account into the system, start the installation.
#yum Install httpd/install Apache
#yum Install PHP/install PHP module
#yum Install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc/install PHP support these components
#yum Install php-mysql/install PHP support MySQL

Second, test Apache run www.111cn.net

1, start Apache
#/etc/init.d/httpd Start/Start Apache
2. Can view Apache running status when needed
#/etc/init.d/httpd status
3, can now open http://localhost or http://127.0.0.1 in the browser, see the Apache 2 Test page page
4, simple test whether the support of PHP
#vi/var/www/html/test.php

When you enter, press I to see-INSERT-you can edit it.

Copy the following test code

<?php
Phpinfo ();
?>

Press: Wq save and exit after pressing ESC on the keyboard

5, again in the browser to open http://localhost/test.php or http://127.0.0.1/test.php
You will see that a lot of modules can be used in PHP5.

This way your Web server is simply deployed.

Iii. Common Instructions
Now talk about some of the parameters and commands that Apache uses every day.

Basic:
#service httpd Restart/restart Apache service

/etc/httpd/conf/httpd.conf/apache configuration file

/var/www/html/Here is the CentOS default "home" directory;
/var/www/error/default system error message, host settings error or browser-side required data error, the error message in the browser is based on the information here
/var/www/icons/provides some small icons of Apache;
/var/www/cgi-bin/default Some executable CGI programs placed in the directory;
/VAR/LOG/HTTPD/log file directory, the file here is very easy to change a lot, need to provide enough space;

Four, set up boot

#chkconfig--levels 3 httpd on/Set APACHEP service set to boot
#chkconfig--list httpd/view boot Service list
httpd 0:off 1:off 2:off 3:on 4:off 5:off/If, execute the previous command, the result is this. The instructions are set to succeed.

Five or one server multiple site Settings

is a single-server multiple-site setup method

If your IP is 192.168.1.1

1, create a directory

#mkdir/etc/httpd/conf/vhost/

2. Modify/etc/httpd/conf/httpd.conf

Plus

Namevirtualhost 192.168.1.1:80 (if it is single IP to fill out as Namevirtualhost *:80)

Include/etc/httpd/conf/vhost/*.conf

3. Recommend the virtual host file under/etc/httpd/conf/vhost/

Vi/etc/httpd/conf/vhost/web001.conf

Edit the following content to copy in

<virtualhost *:80>

<directory "/WEBSERVER/WEB001/" >

Options-indexes FollowSymLinks

Allow from all

AllowOverride All

</Directory>

ServerAdmin paipat@vip.qq.com

DocumentRoot "/webserver/web001/"

ServerName paipat.com

Serveralias www.paipat.com

ErrorLog Logs/www.paipat.com-error_log

</VirtualHost>

Create a few more files, only need to modify the directory and domain name OK.
---------------------------------------------
If it is a level two domain name, press the following setting

<virtualhost *:80>

<directory "/WEBSERVER/WEB001/" >

Options-indexes FollowSymLinks

Allow from all

AllowOverride All

</Directory>

ServerAdmin paipat@vip.qq.com

DocumentRoot "/webserver/web001/"

ServerName bbs.paipat.com

ErrorLog Logs/www.paipat.com-error_log

</VirtualHost>

Remember to add 755 or 777 permissions to the site directory, #chmod 777/www.111cn.net/web001/

Related Article

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.