话不多说直接操作:
(1)、安装nginx依赖:yum install gcc gcc-c++ openssl openssl-devel cyrus-sasl-md5
下载nginx:wget http://nginx.org/download/nginx-1.12.2.tar.gz
解压:tar zxvf nginx-1.12.2.tar.gz
进入nginx目录中并编译安装:
cd nginx-1.12.2
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install
加入环境变量:vi /etc/profile
export PATH= "$PATH:/usr/local/nginx/sbin:"
更新环境变量配置:source /etc/profile
配置项目:/var/www/project
进入/usr/local/nginx/conf/
创建:vhosts文件夹
vi nginx.conf
添加:include vhosts/*.conf
vi project.conf
server {
listen 80;
server_name 140.143.164.43;
#自定义的域名,因为我在内部有自己的DNS服务器
root /home/www/project;
#这个目录看有没有必要再重新指定,默认打算将showdoc代码包解到这里也行
index index.php index.html
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
root /home/www/project;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
(2)、安装php依赖
yum install gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel
下载php:wget http://au1.php.net/get/php-5.6.30.tar.gz/from/this/mirror
mv mirror php-5.6.30.tar.gz
tar zxvf php-5.6.30.tar.gz
./configure --prefix=/usr/local/php --enable-fpm --with-zlib --with-pdo-mysql --enable-mbstring --with-gd --with-png-dir=/usr/lib64 --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr/lib64
安装:
make && make install
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
vi php-fpm.conf
去除pid=run/php-fpm.pid前面的;
user=web
group=web
保存退出
启动:/usr/local/php/sbin/php-fpm
(3)、yum安装mysql
安装资源包:rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
安装:yum -y install mysql-community-server
重置密码: mysql_secure_installation