标签:lnmp
nginx搭建lnmp
安装nginx
准备环境:yum -y install pcre-develzlib-devel ,rpm -e httpd --nodeps,
useradd -M -s/sbin/nologin nginx
2. tar xf nginx-1.6.0.tar.gz -C /usr/src/
3. cd/usr/src/nginx-1.6.0/
4. ./configure--prefix=/usr/local/nginx --user=nginx --group=nginx--with-http_stub_status_module
5. make && make install
6. ln -s/usr/local/nginx/sbin/* /usr/local/sbin/
7. nginx-t ; nginx
8. netstat-anpt | grep 80
二、安装MySQL
1. rpm -e mysql --nodeps rpm -e mysql-devel --nodeps
2. useradd -s -M /sbin/nologin mysql
3. tar xf cmake-TAB
4. cd/root/cmake-TAB
5. ./configure && gmake && gmake install
6. tarxf mysql-TAB -C /usr/src/
7. cd /usr/src/mysql-TAB
8. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci -DSYSCONFDIR=/etc -DWITH_EXTRA_CHARSETS=all
9. make && make install
10. chown -R mysql.mysql /usr/localmysql
11. ln-s /usr/local/mysql/bin/* /usr/local/bin/
12. cp/usr/src/mysql-TAB/support-files/my-medium.cnf /etc/my.cnf
13. cp /usr/src/mysql-TAB/support-files/mysql.server/etc/init.d/mysqld
14. chmod+x /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on
15. /usr/local/mysql/scripts/mysql_install_db--user=mysql --basedir=/usr/local/mysql/
--datadir=/usr/local/mysql/data/
16. servicemysqld restart netstat -tunlp | grep3306
17. mysqladmin-u root password ‘123.com‘
三、安装PHP
1. yum -yinstall gd libxml2-devel libjpeg-delvel libpng-devel
2. tar-zxvf php-TAB.tar.gz -C /usr/src/
3. cd php-TAB
4. ./configure--prefix=/usr/local/php --with-gd --with-zlib --with-mysql=/usr/local/mysql/--with-config-file-path=/usr/local/php --enable-mbstring --enable-fpm--with-jpeg-dir=/usr/lib
5. make&& make install
6. cp/usr/src/php-TAB/php.ini-development /usr/local/php/php.ini
7. vim/usr/local/php/php.ini
修改这两项:default_charset= "utf-8"
short_open_tag= On
8. ln -s/usr/local/php/bin/* /usr/local/bin/
9. ln -s/usr/local/php/sbin/* /usr/local/sbin/
10. 添加优化模块
a) tar -zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz -C /usr/src/
b)cp /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so/usr/local/php/lib/php/
c) vim/usr/local/php/php.ini 添加:
i. zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so
ii. zend_loader.enable=1
创建php-fpm.conf
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf 修改:
pid =run/php-fpm.pid
user = php
group = php
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
/usr/local/sbin/php-fpm
netstat -anpt | grep php-fpm
cp /usr/src/php-TAB/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
vim /usr/local/nginx/conf/nginx.conf
index index.php (添加到location的总文件中)
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000; ###注意
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf; ###注意
}
重启nginx 来验证 :
echo “<?php
phpinfo ();
?>” >> /usr/local/nginx/html/index.php
验证与数据库的链接:
echo “<?php
$link=mysql_connect(‘localhost‘,‘root‘,‘123.com‘);
if($link) echo "恭喜你,数据库连接成功啦!!";
mysql_close();
?> “ >> /usr/local/nginx/html/index2.php
部署电影系统
unzipSKYUC.v3.4.2.SOURCE.zip
cp -rSKYUC.v3.4.2.SOURCE/wwwroot/ /usr/local/nginx/html/skyuc
chown-R php.php /usr/local/nginx/html/skyuc/admincp/ /usr/local/nginx/html/skyuc/data/ /usr/local/nginx/html/skyuc/upload/ /usr/local/nginx/html/skyuc/templates/
创建数据库 create database skyucdb; grantall on skyucdb.* to ‘root‘@‘localhost‘ identified by ‘123.com‘;
firefoxhttp://192.168.1.200/skyuc/install/index.php &
7. firefoxhttp://192.168.1.200/skyudb/admincp
本文出自 “10706057” 博客,请务必保留此出处http://10716057.blog.51cto.com/10706057/1772591
标签:lnmp
原文地址:http://10716057.blog.51cto.com/10706057/1772591