阿里云服务器搭建lnmp环境

2016/11/19 Linux

之前一直都是在虚拟机里安装lnmp的环境, 这回我在阿里云中实际安装一次, 其实也没有多大的区别. 都是远程终端操控的, 搞起.

阿里云服务器搭建lnmp环境

2016年11月19日 星期六 author: qiuyu

硬件和系统

服务器是阿里云的, 虽然阿里云支持免费的lnmp镜像, 但是我还是选择了自己手动安装lnmp环境, 下面开始我的搭建环节.

硬件配置 : 不是什么高级配置. 但是搭建个人的博客还是够用的.

-w1018

系统 : CentOS 6.5 , 在阿里云中, 选择的, 但是也不知道是不是mini安装版.

说明

我原来用的是lamp, 而且都是yum安装. 所以这次我就想换lnmp, 而且除了依赖包, 我都用源码包安装.

我在虚拟机里已经安装过几次lnmp, 这次就在我的服务器上真正的实战吧.

连接阿里云服务器

刚开始连接服务器就给我掉坑里了.

qiuyu :~$ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:fyc0aCdr0ku0iJulLMJ4P/N2DbBB418oiGTVlG5gn6M.
Please contact your system administrator.
Add correct host key in /Users/qiuyu/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/qiuyu/.ssh/known_hosts:5
RSA host key for 120.27.49.93 has changed and you have requested strict checking.
Host key verification failed.
qiuyu :~$ 

相信程序员们都能看懂这些鸟语, 意思就是远程服务器的认证已经改变了. 所以会出现这个东西.

是什么原因呢?

原因是, ssh连接访问服务器, 每次连接, 服务器都会把 公钥(public key) 存放到客户端的~/.ssh/know_host文件里, 以后再次ssh连接这台服务器, 就会核对公钥, 如果不一致, 就会出现警告信息. 这样做的目的是防止一些攻击, 如DNS Hijack之类的攻击.

所以, 解决方案就出来了, 我去~/.ssh/know_host里, 应该会发现我这台阿里云服务器的公钥. OK, let’s go.

qiuyu :~/.ssh$ ll ~/.ssh
total 24
drwx------   5 qiuyu  staff   170B 11 18 17:30 ./
drwxr-xr-x+ 44 qiuyu  staff   1.5K 11 18 17:30 ../
-rw-------   1 qiuyu  staff   1.6K 11 14 15:27 id_rsa
-rw-r--r--   1 qiuyu  staff   398B 11 14 15:44 id_rsa.pub
-rw-r--r--   1 qiuyu  staff   1.9K 11 18 17:49 known_hosts
qiuyu :~/.ssh$ 

就是这个文件. 打开它看看 还是图片来的直观. 看图

-w640

第一个是我的虚拟机, 所以没有遮掩掉IP, 嘿嘿. 看最下面的那一个. 就是我的阿里云服务器的公钥, OK, 直接删掉, 简单粗暴. 然后再次连接我的阿里云服务器试试. -w639

现在我没有公钥, 所以会出现这个提示信息. 输入yes. 就ok了. -w550 提示我, 加入了 RSA 到我的know_hosts里了. 并且已经连接成功.

准备工作

  1. 防火墙配置

    首先查看防火墙状态

     [[email protected] ~]# service iptables status
    iptables: Firewall is not running.
    [[email protected] ~]# 
    

    ok, 可以看到, 防火墙是关闭的状态. 下面开始配置防火墙.

     [[email protected] ~]# vi /etc/sysconfig/iptables
    

    我靠, 防火墙的配置文件没有, 看一下目录.

     [[email protected] ~]# ls /etc/sysconfig/
     atd         init              network-scripts  saslauthd
     auditd      ip6tables-config  ntpd             selinux
     authconfig  iptables-config   ntpdate          smartmontools
     cbq         irqbalance        prelink          sshd
     clock       kdump             quota_nld        sysstat
     console     kernel            raid-check       sysstat.ioconf
     cpuspeed    keyboard          readahead        system-config-firewall
     crond       modules           readonly-root    system-config-firewall.old
     firstboot   netconsole        rngd             udev
     grub        network           rsyslog
     i18n        networking        sandbox
     [[email protected] ~]# 
    

    恩. 确实不存在. 怎么处理呢? 我的第一反应是需要自己创建一个. 先google了一下.

    原因 : 在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。

    既然没有开启, 那我就偷个懒, 先不管防火墙了.

  2. 关闭SElinux

    先打开SElinux的配置文件.

     [[email protected] ~]# vi /etc/selinux/config
    

    在最下面增加一行.

     SELINUX=disabled
    

    保存退出, 然后执行命令 :

     setenforce 0
    

    这样就立即生效了.

安装约定

源码包存放目录: /usr/local/src 源码包安装目录: /usr/local/软件名 数据库数据文件存储路径: /usr/local/mysql/var

上传源码包

mac 下有个ftp软件很好用, 支持中文, 叫yummy ftp -w1006

我的源码包的版本

[[email protected] ~]# cd /usr/local/src
[[email protected] src]# ll
总用量 48948
-rw-r--r-- 1 root root  6068021 9月  18 20:51 cmake-2.8.12.1.tar.gz
-rw-r--r-- 1 root root   523321 9月  18 20:51 libmcrypt-2.5.7.tar.gz
-rw-r--r-- 1 root root 21031206 9月  18 20:51 mysql-5.5.51.tar.gz
-rw-r--r-- 1 root root  2826473 9月  18 20:51 ncurses.tar.gz
-rw-r--r-- 1 root root   768217 9月  18 20:51 nginx-1.4.4.tar.gz
-rw-r--r-- 1 root root  2062258 9月  18 20:51 pcre-8.39.tar.gz
-rw-r--r-- 1 root root 16818359 9月  18 20:51 php-5.5.7.tar.gz

其他的依赖包就都用yum安装了

yum安装依赖包

yum install -y make apr* autoconf automake curl curl-devel gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* cpp glibc libgomp libstdc++-devel keyutils-libs-devel libsepol-devel libselinux-devel krb5-devel libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* libpng* php-common php-gd gettext gettext-devel ncurses* libtool* libxml2 libxml2-devel patch policycoreutils bison

源码安装依赖包

  1. 安装cmake

    进入压缩后的cmake目录

     [[email protected] src]# cd cmake-2.8.12.1
    

    创建安装的目录

     [[email protected] cmake-2.8.12.1]# mkdir /usr/local/cmake
    

    编译

     [[email protected] cmake-2.8.12.1]# ./configure --prefix=/usr/local/cmake/
    

    没有报错, 就安装

     [[email protected] cmake-2.8.12.1]# make && make install
    
  2. 安装pcre, libmcrypt

    创建目录/usr/local/pcre, 解压pcre, 进入目录. 编译, 安装. 略过步骤. libmcrypt同理

源码安装MySQL

首先, 创建安装目录, 以及数据库文件的目录

[[email protected] libmcrypt-2.5.7]# mkdir /usr/local/mysql
[[email protected] libmcrypt-2.5.7]# mkdir /usr/local/mysql/var

再创建启动mysqld的用户和用户组. 这个用户不能登录.

[[email protected] libmcrypt-2.5.7]# groupadd mysql
[[email protected] libmcrypt-2.5.7]# useradd -g mysql mysql -s /bin/false

加压mysql

[[email protected] ~]# cd /usr/local/src
[[email protected] src]# tar zxvf mysql-5.5.51.tar.gz 

进入解压后的mysql目录

[[email protected] src]# cd mysql-5.5.51

编译配置 注意, 要用cmake命令, 而且cmake没有加入环境变量, 所以要写绝对路径.

[[email protected] mysql-5.5.51]# /usr/local/cmake/bin/cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/data/mysql/var -DSYSCONFDIR=/etc

然后安装

make && make install

安装完毕后, 进入安装的目录, 复制配置文件, 提示信息询问是否覆盖, 按y覆盖即可.

[[email protected] mysql-5.5.51]# cd /usr/local/mysql
[[email protected] mysql]# ls
bin      data  include         lib  mysql-test  scripts  sql-bench
COPYING  docs  INSTALL-BINARY  man  README      share    support-files
[[email protected] mysql]# cp ./support-files/my-huge.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
[[email protected] mysql]# 

编辑配置文件

[[email protected] mysql]# vi /etc/my.cnf

新增一行配置, 指定数据库文件的目录. 注意: 得在[mysqld]模块中添加 -w378 完成后, 退出编辑.

生成数据库文件.

[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql

把mysqld加入系统启动, 设置权限, 开机启动.

[[email protected] mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
[[email protected] mysql]# chmod 755 /etc/init.d/mysqld
[[email protected] mysql]# chkconfig mysqld on

编辑开机启动的mysqld文件.

[[email protected] mysql]# vi /etc/rc.d/init.d/mysqld

指定mysql安装目录和数据库文件目录 -w535 保存, 退出编辑

启动mysql

[[email protected] mysql]# service mysqld start
Starting MySQL...                                          [  OK  ]

把mysql加入环境变量中.

[[email protected] mysql]# vi /etc/profile

在最面新增一行, 我这里顺便也把cmake加入了环境变量中.

export PATH=$PATH:/usr/local/cmake/bin:/usr/local/mysql/bin

退出保存, 然后让新加的环境变量立即生效

[[email protected] mysql]# source /etc/profile

添加mysql.sock的软链

[[email protected] mysql]# mkdir /var/lib/mysql
[[email protected] mysql]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

设置mysql的密码

[[email protected] mysql]# mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


[[email protected] mysql]# 

OK, MYSQL已经安装完毕了.

源码安装NGINX

创建nginx安装目录

[[email protected] src]# mkdir /usr/local/nginx

创建用户组和用户, 都是www

[[email protected] src]# groupadd www
[[email protected] src]# useradd -g www www -s /bin/false

解压nginx, 进入解压目录

[[email protected] src]# tar zxvf nginx-1.4.4.tar.gz 
[[email protected] src]# cd nginx-1.4.4

配置编译选项 注意 : –with-pcre=/usr/local/src/pcre-8.39指向的是源码包解压的路径,而不是安装的路径,否则会报错

[[email protected] nginx-1.4.4]# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.39

安装

[[email protected] nginx-1.4.4]# make && make install

安装完毕后, 启动nginx

[[email protected] nginx-1.4.4]# /usr/local/nginx/sbin/nginx

以后每次都这么启动太麻烦, 设置开机自动启动. 编辑文件:

[[email protected] nginx-1.4.4]# vi /etc/rc.d/init.d/nginx

加入以下内容.

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL

然后保存退出, 再设置一下该文件的权限.且加入开机启动.

[[email protected] nginx-1.4.4]# chmod 775 /etc/rc.d/init.d/nginx
[[email protected] nginx-1.4.4]# chkconfig nginx on

现在可以使用命令了. 如:

  1. 重启nginx service nginx restart
  2. 停止nginx service nginx stop
  3. 启动nginx service nginx start

重启nginx

[[email protected] nginx-1.4.4]# service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]
[[email protected] nginx-1.4.4]# 

OK, 一切正常. 来访问我的阿里云服务器, 看看是否可以访问吧. -w1279 一切正常.

源码安装PHP

首先, 还是创建安装目录, 然后解压, 进入解压的目录, 配置编译选项

[[email protected] php-5.5.7]# ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt=/usr/local/libmcrypt --with-curl --with-jpeg-dir --with-freetype-dir

出现报错信息:

configure: error: png.h not found.

解决方案:

yum install libpng-devel

保险起见, 之前yum安装的再执行一遍.

再次执行:

[[email protected] php-5.5.7]# ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt=/usr/local/libmcrypt --with-curl --with-jpeg-dir --with-freetype-dir

ok, 这次没有报错.

然后安装

[[email protected] php-5.5.7]# make && make install

等了好久, 终于安装完毕了.

开始配置php 复制php配置文件到安装目录, 删除系统自带配置文件, 然后添加软链接

[[email protected] php-5.5.7]# cp php.ini-production /usr/local/php5/etc/php.ini
[[email protected] php-5.5.7]# rm -rf /etc/php.ini
[[email protected] php-5.5.7]# ln -s /usr/local/php5/etc/php.ini /etc/php.ini

拷贝模板文件为php-fpm配置文件, 然后编辑

[[email protected] php-5.5.7]# cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf
[[email protected] php-5.5.7]# vi /usr/local/php5/etc/php-fpm.conf

找到user和group的配置位置 -w618 改为: -w614

再找到pid的配置位置 -w608 去掉前面的分号, 改为 -w606 配置完毕, 保存退出.

设置 php-fpm开机启动

  1. 拷贝php-fpm到启动目录
  2. 添加执行权限
  3. 设置开机启动
[[email protected] php-5.5.7]# cp /usr/local/src/php-5.5.7/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
[[email protected] php-5.5.7]# chmod +x /etc/rc.d/init.d/php-fpm
[[email protected] php-5.5.7]# chkconfig php-fpm on

编辑配置文件

设置时区: 找到:;date.timezone = , 修改为:date.timezone = PRC 禁止显示php版本的信息: 找到:expose_php = On , 修改为:expose_php = OFF 支持php短标签: 找到:short_open_tag = Off , 修改为:short_open_tag = ON

配置nginx支持php

编辑nginx的配置文件

[[email protected] php-5.5.7]# vi /usr/local/nginx/conf/nginx.conf

前面提到过, 我把/usr/local/nginx/html目录作为站点的根目录, 而且也给他加了www的组, 且附了权限.

现在我想新建个目录/data/www/blog作为我的博客新站点目录. 赋予权限, 赋予组, 同理.

我的配置

#运行用户
user nobody;
#启动进程,通常设置成和cpu的数量相等
worker_processes  1;
 
#全局错误日志及PID文件
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
#pid        logs/nginx.pid;
 
#工作模式及连接数上限
events {
    #epoll是多路复用IO(I/O Multiplexing)中的一种方式,
    #仅用于linux2.6以上内核,可以大大提高nginx的性能
    use   epoll; 
 
    #单个后台worker process进程的最大并发链接数    
    worker_connections  1024;
 
    # 并发总数是 worker_processes 和 worker_connections 的乘积
    # 即 max_clients = worker_processes * worker_connections
    # 在设置了反向代理的情况下,max_clients = worker_processes * worker_connections / 4  为什么
    # 为什么上面反向代理要除以4,应该说是一个经验值
    # 根据以上条件,正常情况下的Nginx Server可以应付的最大连接数为:4 * 8000 = 32000
    # worker_connections 值的设置跟物理内存大小有关
    # 因为并发受IO约束,max_clients的值须小于系统可以打开的最大文件数
    # 而系统可以打开的最大文件数和内存大小成正比,一般1GB内存的机器上可以打开的文件数大约是10万左右
    # 我们来看看360M内存的VPS可以打开的文件句柄数是多少:
    # $ cat /proc/sys/fs/file-max
    # 输出 34336
    # 32000 < 34336,即并发连接总数小于系统可以打开的文件句柄总数,这样就在操作系统可以承受的范围之内
    # 所以,worker_connections 的值需根据 worker_processes 进程数目和系统可以打开的最大文件总数进行适当地进行设置
    # 使得并发总数小于操作系统可以打开的最大文件数目
    # 其实质也就是根据主机的物理CPU和内存进行配置
    # 当然,理论上的并发总数可能会和实际有所偏差,因为主机还有其他的工作进程需要消耗系统资源。
    # ulimit -SHn 65535
 
}
 
 
http {
    #设定mime类型,类型由mime.type文件定义
    include    mime.types;
    default_type  application/octet-stream;
    #设定日志格式
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    access_log  logs/access.log  main;
 
    #sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,
    #对于普通应用,必须设为 on,
    #如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,
    #以平衡磁盘与网络I/O处理速度,降低系统的uptime.
    sendfile     on;
    #tcp_nopush     on;
 
    #连接超时时间
    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay     on;
 
    #开启gzip压缩
    gzip  on;
    gzip_disable "MSIE [1-6].";
 
    #设定请求缓冲
    client_header_buffer_size    128k;
    large_client_header_buffers  4 128k;
 
 
    #设定虚拟主机配置
    server {
        #侦听80端口
        listen    80;
        #定义使用 www.nginx.cn访问
        server_name  www.nginx.cn;
 
        #定义服务器的默认网站根目录位置
        root html;
 
        #设定本虚拟主机的访问日志
        access_log  logs/nginx.access.log  main;
 
        #默认请求
        location / {
            
            #定义首页索引文件的名称
            index index.php index.html index.htm;   
 
        }
 
        # 定义错误提示页面
        error_page   500 502 503 504 /50x.html;
        location = /50x.html {
        }
 
        #静态文件,nginx自己处理
        location ~ ^/(images|javascript|js|css|flash|media|static)/ {
            
            #过期30天,静态文件不怎么更新,过期可以设大一点,
            #如果频繁更新,则可以设置得小一点。
            expires 30d;
        }
 
        #PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.
        location ~ .php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
 
        #禁止访问 .htxxx 文件
            location ~ /.ht {
            deny all;
        }
 
    }
}

启动php-fpm

service php-fpm start

/data/www/blog目录中, 新建index.php文件.

内容为:

<?php
	echo phpinfo();

然后访问, www.qiuyuhome.com -w1279

OK了, 阿里云的lnmp环境就搭建完成.

LNMP常用命令总结

service nginx restart #重启nginx service nginx start #启动nginx service nginx stop #停止nginx

service mysqld restart #重启mysql

/usr/local/php/sbin/php-fpm #启动php-fpm /etc/rc.d/init.d/php-fpm restart #重启php-fpm /etc/rc.d/init.d/php-fpm stop #停止php-fpm /etc/rc.d/init.d/php-fpm start #启动php-fpm

service php-fpm start #启动php-fpm service php-fpm restart #重启php-fpm service php-fpm stop #关闭php-fpm

nginx默认站点目录是:/usr/local/nginx/html/ 权限设置:chown www.www /usr/local/nginx/html/ -R MySQL数据库目录是:/usr/local/mysql/var 权限设置:chown mysql.mysql -R /usr/local/mysql/var

Search

    Post Directory