1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > linux + nginx + mysql + php 百度网盘_5.LNMP(Linux + Nginx + MySQL + PHP)环境安装

linux + nginx + mysql + php 百度网盘_5.LNMP(Linux + Nginx + MySQL + PHP)环境安装

时间:2021-12-25 20:34:55

相关推荐

linux + nginx + mysql + php 百度网盘_5.LNMP(Linux + Nginx + MySQL + PHP)环境安装

1.安装Nginx:

yum install yum-priorities -y

wget /packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum -y install nginx

systemctl start nginx.service

systemctl stop nginx.service

systemctl restart nginx.service

systemctl enable nginx.service

2.安装php (使用FastCGI方式)

yum -y install php php-fpm

systemctl start php-fpm.service

systemctl enable php-fpm.service

vi /etc/nginx/conf.d/default.conf

cat /etc/nginx/conf.d/default.conf

-------------------------------------------------------

里面加入了下面这段:

location ~ \.php$ {

root /usr/share/nginx/html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include /etc/nginx/fastcgi_params;

}

--------------------------------------------------------

cd /usr/share/nginx/html/

vi test.php

cat test.php

-----------------------------

phpinfo():

?>

-----------------------------

systemctl restart php-fpm

systemctl restart nginx

systemctl restart php-fpm

浏览器访问验证:

最后还需要执行一条:

yum -y install php-mysql

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。