首页 > 系统相关 >laravel:部署到nginx服务器(10.27.0)

laravel:部署到nginx服务器(10.27.0)

时间:2023-10-21 09:00:09浏览次数:41  
标签:laravel index log 10.27 nginx php fastcgi

一,相关文档:

https://learnku.com/docs/laravel/10.x/deployment/14840

二, 配置nginx

1,站点文件

server {
    listen 80;
    #listen [::]:80;
    server_name dig.lhdtest.com;
    root /webdata/site/dig/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;
    access_log      /webdata/logs/nginxlogs/dig.access_log;
    error_log       /webdata/logs/nginxlogs/dig.error_log;
    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        #fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

2,重启服务

[root@lhdpc conf.d]# systemctl restart nginx.service

三,测试效果:

四,查看laravel和nginx的版本:

laravel:

liuhongdi@lhdpc:/data/laravel/dignews$ php artisan --version
Laravel Framework 10.27.0

nginx:

liuhongdi@lhdpc:/data/laravel/dignews$ nginx -v
nginx version: nginx/1.18.0 (Ubuntu)

标签:laravel,index,log,10.27,nginx,php,fastcgi
From: https://www.cnblogs.com/architectforest/p/17778443.html

相关文章

  • Nginx安装lua模块
    前提已安装完成Nginx安装LuaJITwgethttp://luajit.org/download/LuaJIT-2.0.5.tar.gztar-zxvf LuaJIT-2.0.5.tar.gzcdLuaJIT-2.0.5makeinstallPREFIX=/usr/local/LuaJITecho"exportLUAJIT_LIB=/usr/local/LuaJIT/lib">>/etc/profileecho"expor......
  • Nginx Lua修改返回值
    调试lua脚本ngx.log(ngx.ERR,"xxx")日志会打印到/usr/local/nginx/logs/error.log修改返回值时避免内容被截断增加header_filter_by_lua'ngx.header.content_length=nil';注释后只返回原接口长度3,即ok\n。lua脚本默认必须放在/usr/local/nginx目录下,否则会找不到。mod......
  • nginx首次安装sticky模块-cookie保持会话
    首次安装nginx:(下一篇文章是nginx添加sticky模块)yuminstall-ypcre*openssl*gccgcc-c++make--安装编译环境wgethttps://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip--下载sticky模块nginx-v--查看Nginx版本,因为要下载和yum安装nginx......
  • nginx添加sticky模块-cookie保持会话
    环境nginx1.8.0 centos6.X sticky:1.2.5 wgethttps://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gzcookie负载均衡相比iphash来比其中一个特点比较明显:内网nat用户的均衡。而iphash无法做到。yuminstallopenssl openssl-devel先停止ngi......
  • ansible使用【2】--安装Nginx并熟悉playbook
    前提:主控机器已经安装好ansible,被控制的是53.225安装教程看:https://www.cnblogs.com/liqi175/p/17776530.html参考资料:https://ansible.leops.cn/basic/Quickstart/安装Nginx:ansible192.168.53.225-mapt-a'name=nginx' 说明:-m指定模块,我这里指定apt安装模块......
  • kkfile4.0 nginx映射踩坑
    官网文档要修改base.url和service.context-path,但是修改后不起作用! 后花了大半天翻阅文档后才发现4.0并没有service.context-path,要修改server.servlet.context-path!!!!!(base.url同样要修改)  修改后  原帖:https://juejin.cn/post/7032191684440293390......
  • ES 结合nginx 实现自定义词库
    dockerrun-p80:80--namenginx-dnginx:1.10将容器内的配置文件拷贝到当前目录:dockercontainercpnginx:/etc/nginx.修改文件名称:mvnginxconf把这个conf移动到/mydata/nginx下执行命令删除原容器:dockerrmnginx创建新的nginx;执行以下命令dockerrun-......
  • nginx生成自签名证书
    创建服务器证书秘钥文件[root@Nginx~]#opensslgenrsa-des3-outserver.key1024...Enterpassphraseforserver.key: #输入密码Verifying-Enterpassphraseforserver.key: #确认密码创建服务器证书申请文件[root@Nginx~]#opensslreq-new-key......
  • Laravel Faker Readme
    Faker   FakerisaPHPlibrarythatgeneratesfakedataforyou.Whetheryouneedtobootstrapyourdatabase,creategood-lookingXMLdocuments,fill-inyourpersistencetostresstestit,oranonymizedatatakenfromaproductionservice,Fakerisfor......
  • laravel:异常时返回json(10.27.0)
    一,相关文档:https://learnku.com/docs/laravel/10.x/errors/14857#87364d二,php代码:1,app\exceptions\Handler.php增加以下一段:1234567891011//重写renderpublicfunctionrender($request,Throwable$e){    if(env('APP_DEBUG')){  ......