LNMP搭建
Nginx:
1.安装nginx yum源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.yum install nginx -y
3.mv /etc/nginx/conf.d/default /etc/nginx/conf.d/vhost.conf
vim vhost.conf
server {
listen 80;
server_name www.lh.com;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /php/nginx/web/$fastcgi_script_name;
include fastcgi_params;
}
}
4.mkdir /php/nginx/web -pv
vim index.php
<?php
phpinfo();
?>
用于测试php是否部署成功
5.yum install php-fpm -y
vim /etc/php-fpm-d/www.conf
user=nginx
group=ngnx
6.yum install mariadb-server mariadb -y
略
7.systemctl start nginx mariadb php-fpm