Web server configuration in Linux

Source: Internet
Author: User

All the software is stored in the/home/web directory.
1. MYSQL configuration process:
[Root @ mail web] # tar zxvf mysql-5.0.18.tar.gz
[Root @ mail web] # mysql-5.0.18 cd
[Root @ mail mysql-5.0.18] # groupadd mysql
[Root @ mail mysql-5.0.18] # useradd-g mysql
[Root @ mail mysql-5.0.18] #./configure -- prefix =/usr/local/mysql # Install MYSQL to the specified directory
[Root @ mail mysql-5.0.18] # make
[Root @ mail mysql-5.0.18] # make install
[Root @ mail mysql-5.0.18] # scripts/mysql_install_db
[Root @ mail mysql-5.0.18] # chown-R root/usr/local/mysql
[Root @ mail mysql-5.0.18] # chown-R mysql/usr/local/mysql/var
[Root @ mail mysql-5.0.18] # chgrp-R mysql/usr/local/mysql
[Root @ mail mysql-5.0.18] # cp support-files/my-medium.cnf/etc/my. cnf
Run the following command to start the MySQL database ):
[Root @ mail mysql-5.0.18] #/usr/local/mysql/bin/safe_mysqld -- user = mysql &
Append the preceding startup command to the end of the file "/etc/rc. d/rc. local" to enable the MySQL database server automatically when the operating system starts. The following initialization settings for MYSQL: [root @ mail mysql-5.0.18] #/usr/local/mysql/bin/mysql to enter the MYSQL client tool, related settings
Mysql> drop database test;
Mysql> use mysql;
Mysql> delete from mysql where user = "";
Mysql> delete from mysql where host = "% ";
Mysql> delete from db;
Currently, the mysql database only allows the root user of the local mysql Administrator (different from the root user of the operating system) to connect. Use the following command to specify the password for the root user:
[Root @ mail mysql-5.0.18] # cd/usr/local/mysql/bin
[Root @ mail bin] #./mysqladmin-u root @ localhost password "123456"
"123456" indicates the ROOT user password. Create a new database as needed
[Root @ mail bin] #./mysql-u root-p
Mysql> create database linux;
Mysql> grant all privileges on linux. * to linux @ localhost identfied by 'linux ';
Mysql> exit;
[Root @ mail bin] #./mysqladmin-u root @ localhost-p flush-privileges;
The above command creates a mydb database and grants all its permissions to linux users. The password is "linux" and can only log on to the database from the local machine.
2. configuration process of Apache And PHP:
[Root @ mail web] # tar zxvf httpd-2.0.50.tar.gz
[Root @ mail web] # httpd-2.0.50 cd
[Root @ mail web] # httpd-2.0.50 cd
[Root @ mail httpd-2.0.50] #./configure -- prefix =/usr/local/apache2 -- enable-module = so
[Root @ mail httpd-2.0.50] # make
[Root @ mail httpd-2.0.50] # make install
[Root @ mail httpd-2.0.50] # cd ..
[Root @ mail web] # tar zxvf php-5.0.0.tar.gz # install and configure PHP
[Root @ mail web] # tar zxvf php-5.0.0.tar.gz
[Root @ mail web] # php-5.0.0 cd
[Root @ mail php-5.0.0] #. /configure -- enable-track-vars -- with-mysql =/usr/local/mysql-with-apxs2 =/usr/local/apache2/bin/apxs -- disable-libxml -- disable-dom -- disable-******* lxml -- enable-soap -- enable-xml
# Because installed Apache is a relatively high version, so -- with-Retrial this should be changed to -- with-apxs2, and PHP5 added a lot of extension features, so be sure to add, otherwise it will report an error.
[Root @ mail php-5.0.0] # make
[Root @ mail php-5.0.0] # make install
[Root @ mail php-5.0.0] # cp php. ini-dist/usr/local/lib/php. ini # copy this file to the/usr/loca/lib/directory and change it to php. ini
The following is how to modify the Apache configuration file.
[Root @ mail php-5.0.0] # vi/usr/local/apache2/conf/httpd. conf
AddType application/x-httpd-php. php
Modify DirectotyIndex index.html. var
DirectoryIndex index. php index.html index.htm
Edit the "/usr/local/lib/php. ini" file. Change OFF to ON
Register_globals = on
Run the following command to start the WEB server and add it to the "/etc/rc. d/init. d/rc. local" file so that it can be automatically started upon startup.
[Root @ mail php-5.0.0] #/usr/local/apache2/bin/apachectl start
You can create the test. php file in the directory "/usr/local/apache/htdocs/" to test the system.
Phpinfo ();
?>
Enter http: // your_ip/test in the browser. php (your_ip is the IP address of the server), you can see the basic configuration information of php, And there is information about the MySQL database support, if not, the configuration is wrong, you need to check the above steps.
To fully utilize the rich application software on the windows platform, we will use the Samba server in Linux to communicate with the windows host, web pages and related php program files are directly stored on the linux server after being developed in windows. You do not need to use ftp or other tools to upload them.
First, confirm that the Samba package is installed in the current Linux operating system. If not, install the package and continue the following steps.
Edit the samba configuration file "/etc/samba/smb. conf" and add the following content at the end: Copy codeThe Code is as follows: [linux]
Path =/home/linux
Valid = user php
Public = no
Writable = yes
Printable = no
Creat mask = 0755

Run the following command to add system users and samba users:
[Root @ mail web] # adduser php
[Root @ mail web] # smbadduser php: php
(Enter the samba password and use it when logging on to the samba server in windows)
[Root @ mail web] #/etc/rc. d/init. d/smb start # start SMB
Run the following command to enable automatic startup of the samba server at startup:
[Root @ localhost root] # chkconfig -- level 3 smb on
On the windows client (NT/2000 is recommended), use the Server IP Address "Search for computer". Find the computer and double-click the computer icon. In the displayed dialog box, enter "php ", enter the samba password set using the "smbadduser" command in the password box. Then, the samba server's shared directory "homepage" is displayed. Right-click the icon and select "ing network drive ", it can be mapped to a local logical drive letter. All the following web pages and programs can be directly stored on the Linux server through the disk operator.

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.