标签:lnmp
1.nginx安装:(web01)
yum install -y pcre-devel openssl-devel gcc-c++
useradd -s /sbin/nologin -M www
tar -zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2
./configure --user=www --group=www --prefix=/application/nginx-1.10.2 --with-http_stub_status_module --with-http_ssl_module
make && make install
ln -s /application/nginx-1.10.2/ /application/nginx
cd /application/nginx/conf/
egrep -v ‘#|^$‘ nginx.conf.default > nginx.conf
mkdir extra
cd extra/
vim blog.conf
=========================
server {
listen 80;
server_name blog.ls.com;
location / {
root html/blog;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
=========================
vim nginx
========================================================================
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
include extra/blog.conf;
}
=========================================================================
cd /application/nginx/html/
mkdir blog
cd blog/
echo "this is test html!!" > index.html
cat index.html
/application/nginx/sbin/nginx -t
/application/nginx/sbin/nginx
curl 10.0.0.200(你的web的ip)
2mysql安装部署:(db01)
tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.34-linux-glibc2.5-x86_64 /application/mysql-5.6.34
ln -s /application/mysql-5.6.34/ /application/mysql
useradd -s /sbin/nologin -M mysql
chown -R mysql.mysql /application/mysql
chown -R mysql.mysql /applicatipn/mysql/*
./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/
cp support-files/mysql.server /etc/init.d/mysqld
sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /etc/init.d/mysqld
sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /application/mysql/bin/mysqld_safe
cp /etc/my.cnf{,.bak}
cp my.cnf /etc/my.cnf
/etc/init.d/mysqld start
ln -s /application/mysql/bin/* /usr/local/sbin/
mysqladmin -uroot password ‘oldboy123‘
mysql -uroot -p‘oldboy123‘
---数据库操作
create database wordpress;
grant all on wordpress.* to wordpress@‘172.16.1.%‘ identified by ‘oldboy123‘;
grant all on wordpress.* to wordpress@‘localhost‘ identified by ‘oldboy123‘;
exit
mysql -uwordpress -p‘oldboy123‘ #测试账号是否好使;
3php部署安装(web01)
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel -y
yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y
rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel freetype-devel libpng-devel gd-devel libcurl-devel
libxslt-devel libxslt-devel
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
cd ..
tar -zxvf php-5.5.32.tar.gz
cd php-5.5.32
./configure --prefix=/application/php-5.5.32 --with-mysql=mysqlnd --enable-mysqlnd --with-mysqlli=mysqlnd --with-pdo-
mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-
dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl
--enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --
enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --
with-fpm-group=www --enable-ftp
可能出现问题解决:
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar
make && make install
ln -s /application/php-5.5.32/ /application/php
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc
cp php-fpm.conf.default php-fpm.conf
/application/php/sbin/php-fpm
lsof -i:9000 #测试
链接:(web01)
cd /application/nginx/html/blog/
vim index.php
========
<?
phpinfo()
?>
========
cd ../../extra/
vim blog.conf
================================
server {
listen 80;
server_name blog.ls.com;
root html/blog;
index index.php index.html index.htm;
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
===================================
cd /application/nginx/html/blog
/application/nginx/sbin/nginx -t
/application/nginx/sbin/nginx -s reload
测试:
cd /application/nginx/html/blog
vim mysql.php
------------------
<?php
$link=mysql_connect("172.16.1.201","wordpress","oldboy123");
if(!$link) echo "FAILD!连接错误,用户名密码不对";
else echo "OK!可以连接";
?>
-------------------
vim test.php
------------------
<?php
phpinfo;
------------------
curl 10.0.0.200/tets.php
curl 10.0.0.200/mysql.php
本文出自 “我的学习” 博客,请务必保留此出处http://shuai12138.blog.51cto.com/10118203/1910547
标签:lnmp
原文地址:http://shuai12138.blog.51cto.com/10118203/1910547