contos8配置LNMP环境

本文详细介绍了如何在阿里云ECSCentOS8实例上手动部署并配置LNMP(Linux、Nginx、MySQL、PHP)环境,重点讲解了Nginx的服务器块和处理PHP请求的部分。
摘要由CSDN通过智能技术生成

参考阿里云官方:
https://help.aliyun.com/zh/ecs/use-cases/manually-deploy-an-lnmp-environment-on-a-centos-8-instance?spm=a2c4g.11186623.0.0.f280e417ivTvJX#section-e2p-4y1-hlt

nginx 配置



server {
    listen       80;
    server_name xxxx;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        #root   /home/www/contrast/public;
        index  index.html index.htm index.php;
        if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
         }
    }
    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }


    #
    location ~ \.php$ {
        root           /home/www/contrast/public;
        fastcgi_pass   unix:/run/php-fpm/www.sock;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }


}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值