目 录CONTENT

文章目录

LNMP

ZERO
2022-09-17 / 0 评论 / 0 点赞 / 54 阅读 / 0 字

1、安装Nginx

cat > /etc/yum.repo.d/nginx.repo <<EOF
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF

yum install nginx -y
systemctl enable nginx
systemctl start nginx

2、安装MariaDB

yum install mariadb-server
systemctl enable mariadb
systemctl start mariadb

3、安装PHP

rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php71w php71w-fpm php71w-mbstring php71w-common php71w-gd php71w-mcrypt php71w-mysql php71w-xml php71w-cli php71w-devel php71w-pecl-memcached php71w-pecl-redis php71w-opcache php-intl
systemctl enable php-fpm
systemctl start php-fpm

4、修改Nginx配置文件

vim nginx.conf
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;
}

测试页面

<?php
    phpinfo();
?>
0

评论区