Nginx Installation Configuration
Installing Nginx
System Environment: CentOS-6.3
Software: nginx-1.7.9.tar.gz
Installation method: Source code compiled and installed
Installation Location:/usr/local/nginx
Installation Prerequisites
Before installing Nginx, you need to ensure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed. Installation must be software:
[[email protected]/] # Yum Install gcc-c++ [[email protected]/] # yum-y install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel
Check the system installation Nginx:
[[email protected]/] # find-name nginx./Nginx. /nginx/sbin/Nginx. /nginx-1.7.9/objs/nginx
Uninstall the original Nginx
[[email protected]/] # Yum Remove Nginx
Installation
Upload the installation package file to/usr/local/soft to do the following:
[[Email protected] ~] # su Root [[Email protected] ~] # cd/usr/local [[email protected] local] # mkdir Soft [[email protected] local] # CD Soft [[email protected] soft] # wget http://nginx.org/download/nginx-1.7.9.tar.gz
Unzip
[[email protected] soft] # tar-zxv-f nginx-1.7.9.tar.gz [[email protected] soft] # lsnginx-1.7.9 nginx-1.7.9tar.gz[root@webServer Soft]# MV nginx-1.7.9/usr/local/ Nginx[root@webServer soft]# rm-rf nginx-1.7.9.tar.gz
Compiling the installation
[[email protected] nginx] # ./configure--prefix=/usr/local/nginx--conf-path=/usr/local/nginx/nginx.conf [Root@webServer Nginx] # Make&&make Install
After the installation is complete, the directory has the following files:
[[email protected] nginx]# ls
Auto fastcgi.conf koi-win mime.types. Default scgi_paramschanges fastcgi.conf. default LICENSE nginx.conf scgi_params. Defaultchanges.ru fastcgi_params logs nginx.conf. default srcconf fastcgi_params. default Makefile objs uwsgi_paramsconfigure html man README uwsgi_params. default contrib koi-utf mime.types sbin
Configuration
#[[email protected] nginx]# vi +/etc/sysconfig/iptables#-A INPUT- M state--state new-m tcp-p TCP--dport-J ACCEPT#[[email protected] nginx]# Service iptables Restart
Start Nginx
# Method 1 [[email protected] nginx] # /usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf # Method 2 [[email protected] nginx] # Cd/usr/local/nginx/sbin [[email protected] sbin] # ./nginx
Stop Nginx
#[[email protected] nginx]# ps-ef | grep nginx#[[email protected] Nginx]## [[email protected] nginx]## [[email protected] nginx]# pkill-9 nginx
Re-start Nginx
[[email protected] nginx] # /usr/local/nginx/sbin/nginx-s Reload
Test whether the installation was successful
#[[email protected] nginx]#netstat–na|grep#http://127.0.0.1:80
MySQL installation configuration
1. Install via Yum
#直接安装yum源中的mysql [[Email protected] ~] #yum-y install mysql-server
2. Modify the MySQL configuration
#暂修改默认编码 [[Email protected] ~] #vim/etc/my.cnf add default-character-set = UTF8/var/lib/mysql #mysql database file storage location /var/log/ Mysqld.log The log output of the #mysql database is stored in the location netstat-anp #命令来查看3306端口是否在监听
3. Set up MySQL to boot with the system
#设置MySQL服务随系统启动自启动 [[Email protected] ~] #chkconfig mysqld on [[Email protected] ~] #chkconfig--list mysqld Make sure the 2--5 is on, and then start the MySQL service . [[Email protected] ~] #/etc/rc.d/init.d/mysqld Start
4. Set root password and user action
#为root用户设置密码[[Email protected] ~]/usr/bin/mysqladmin-u root password ' newpassword '#用root用户登录MySQL服务器[[Email protected] ~]#mysql-U root-p#查看用户信息Mysql>select User,host,password from Mysql.user;#建立对test数据库有完全操作权限的名为userA的用户#格式: Grant Select on database name. * To User name @ login host identified by "key";Mysql>Grant all privileges the test.* to [e-mail protected] identified by ' user key ';#创建一个可以从任何地方连接服务器的一个完全的超级用户userMMysql>Grant all privileges on * * to [e-mail protected]% identified by ' key ';#删除root的远程授权Mysql>revoke all privileges on * * FROM [email protected] "%";#删除root的远程用户Mysql>Delete from user where user= "root" and host= "%";#刷新 make these actions effectiveMysql>flush Privileges;#修改userA的密码为NewPasswordMysql>Set password for [email protected]=password (' newpassword ');#删除匿名用户Mysql>Delete from mysql.user where user= ';
5. Database Common SQL
Mysql>show databases; #查看系统中所有数据库Mysql>drop database test; #删除名为test的数据库, do not remindMysql>mysqladmin drop test; #删除名为test的数据库前, there are hintsMysql>Show variables like ' Port '; #mysql查看打开的端口Mysql>CREATE database test; #建立名为test的数据库Mysql>Use test; #连接到数据库Mysql>show tables; #查看数据库中已存在的表Mysql>ALTER TABLE test rename Test_study; #重命名表test为test_studyMysql>describe test; #表的详细描述
Mysqldump in 6.CentOS system
#备份数据库[[Email protected] ~]mysqldump-h yourhost vi-uroot-p dbname <dbname_backup.sql#恢复数据库[[Email protected] ~]mysqldump-h yourhost-uroot-p dbname < Dbname_backup.sql#如果只想Dump建表指令, the command is as follows:[[Email protected] ~]mysqladmin-u root-p-D databasename > A.sql#如果只想Dump插入数据的sql命令 without the need to build a table command, the command is as follows:[[Email protected] ~]mysqladmin-u root-p-t databasename > A.sql#那么只想要数据, and you don't want any SQL commands,[[Email protected] ~]mysqldump-t./phptest Driver#其中, only the-t parameter is specified to output a plain text file that represents the directory of the output data./Represents the current directory, that is, the same directory as mysqldump. #如果不指定driver table, the data for the entire database is unloaded. Each table generates two files, one for the. sql file, which contains the build table execution. The other is a. txt file that contains only data and no SQL instructions.
PHP Installation Configuration
#获取需安装的PHP版本 [[email protected] soft] #wget http://cn2.php.net/get/php-5.6.9.tar.gz #解压 [[email protected] soft] # tar-zxvf php-5.6.9.tar.gz #编译安装 [[email protected] soft] # CD php-5.4.26 [[email protected] php-5.4.26] #./configure--prefix=/usr/local/php--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd- -with-mysqli=mysqlnd--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib-- WITH-LIBXML-DIR=/USR--enable-xml--enable-sockets--enable-fpm--with-mcrypt--with-config-file-path=/etc-- WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2 [[email protected] php-5.4.26] # make&&make install
[[email protected] php-5.4.26] # cd/usr/local/php [[email protected] PHP] # CP php.ini-production php.ini
Server Erection-----CentOS set up www server-nginx+mysql+php