APACHE2 Web server configuration steps to share _linux

Source: Internet
Author: User
Tags php and mysql phpinfo unpack

Installation Configuration Apache2
1. Download the latest source code package to the Apache (www.apache.org) Official website
2. With TAR-ZXVF apache_[version].tar.gz decompression, get a directory
3. Enter directory execution./configure Prefix=[path] Enable-module=so start configuration
For example, to install Apache under/www/, you can./configure Prefix=/wwwenable-moudle=so
4. Execute make after configuration, then make Install,apache installation complete.
If you want to change the directory, you can use MV source file (directory) name of the new file (directory) name renamed, corresponding to modify the APAHCE directory of the configuration file/conf/httpd.conf, will be the corresponding path to get rid of.
Configure MySQL
Because MySQL from the official website (www.mysql.com) is already compiled binary package, do not need to compile their own, download to the appropriate location than this example is down to/www/under.
1. Add a user group and user to the Mysqld
shell> Groupadd MySQL
shell> useradd-g MySQL MySQL
2. With tar-zvxf mysql-version-os.tar.gz unpack, and then renamed to MYSQ with MV, that is to get such a directory/www/mysql
3. According to user manual (/www/mysql/docs/man/manual.html), enter/www/mysql/bin edit mysqlaccess, find $mysql = "/usr/local/bin/mysql", Change this row path to "/www/mysql/bin/mysql"
4. Execute/www/mysql/scripts/mysql_install_db (if you have not installed MySQL before)
5. Make the appropriate user authorization:
Shell> Chown-r Root/usr/local/mysql
Shell> Chown-r Mysql/usr/local/mysql/data
Shell> Chgrp-r Mysql/usr/local/mysql
6. Edit/www/mysql/support-files/mysql.server, find basedir=, change to Basedir=/www/mysql, find datadir= ..., change to datadir=/www/mysql/ Data
7. Followed by the implementation of Bin/mysqld_safe User=mysql &
8. Edit/WWW/MYSQL/SUPPORT-FILES/MY-MEDIUM.CNF Add Basedir=/www/mysql under the [mysqld] column and save the CP my-medium.cnf/etc/my.cnf
9. Then you can go to/www/mysql/support-files to perform mysql.server stop/start see if there is any reaction
Install PHP4
1. Download the latest source code package (currently php-4.3.3.tar.gz) to the official website
2. Use tar to unpack (method I don't have to say it again)
3. Configure PHP4 execution./configure prefix=/www/php4 with-mysql=/[path to MySQL]
With-apxs2=/[path to Apxs] where two of the path should be changed to With-mysql=/www/mysql
With-apxs2=/www/apapche/bin/apxs, execute make after the configuration succeeds, then make install,php install complete
4. Edit/www/apache/conf/httpd.conf Join
AddType application/x-httpd-php. php. phtml
AddType Application/x-httpd-php-source. Phps
These two lines.
5. Through/www/apache/bin/apachectl start
If there are no problems during startup, you can test the installation of Apache and PHP and MySQL by creating a file called Phpinfo.php that contains the following code, saves the file, and places it under the Apache document Root (Htdocs). Then start your Web browser, type http://localhost/phpinfo.php in the browser's address bar, and the browser will display a large number of variables and variable values for PHP and Apache systems. If you see details of apache,mysql.php in it, the installation configuration for 3 is successful.
6. Because PHP is installed in dynamic modules under Apache, so if you want to reset PHP, just execute the./configure command with the new configuration option, and then execute make and make install; A new module will appear in the Apache module directory, you just reboot Apache to load the new module.

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.