首页 > 系统相关 >Ubuntu 使用nginx部署thinkphp8配置

Ubuntu 使用nginx部署thinkphp8配置

时间:2024-07-26 20:06:39浏览次数:9  
标签:thinkphp8 cache index no nginx location Ubuntu php fastcgi

server {
listen 80;
server_name emall.alliky.cn;

root /var/www/html/EMALL_EVTP8_SERVER/public;
index index.php index.html index.htm;

# 防止文件缓存
location ~* \.(css|js|jpg|jpeg|png|gif|ico|woff|woff2|css.map|js.map|txt)$ {
    expires 14d;
    add_header Cache-Control "no-cache, no-store, must-revalidate";
    add_header Pragma "no-cache";
}

location / {
    #try_files $uri $uri/ /index.php$is_args$args;
    if (!-e $request_filename) {
        rewrite  ^(.*)$  /index.php?s=/$1  last;
    }
}

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; # 根据PHP版本和配置修改
    include snippets/fastcgi-php.conf;

    # With php-fpm (or other unix sockets):
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
}

# 防止直接访问.htaccess和.htpasswd文件
location ~ /\.ht {
    deny all;
}

}

标签:thinkphp8,cache,index,no,nginx,location,Ubuntu,php,fastcgi
From: https://www.cnblogs.com/wxianing/p/18326166

相关文章

  • 【踩坑系列-Docker】基于Alibaba Cloud Linux3基础镜像安装Nginx
    Author:赵志乾Date:2024-07-26Declaration:AllRightReserved!!!1.问题描述    使用AlibabaCloudLinux3作为基础镜像,在其上安装Nginx,对应的Dockerfile内容如下:#指定基础镜像FROMalibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:lat......
  • Nginx服务器无法实现伪静态化,在后台设置不成功
    错误提示:Nginx服务器无法实现伪静态化,在后台设置不成功解决方案:这主要是nginx的rewrite没有设置导致的在nginx.conf里找到网站的server配置段,一般我们推荐如下的配置     server {        listen          80;        server_name   ......
  • Nginx review
    Nginx的组成nginx二进制可执行文件:由各模块源码编译出的一个文件nginx,conf配置文件:控制nginx的行为access.log访问日志:记录每一条http请求信息error.log 错误日志:定位问题Nginx版本发布情况选择哪个版本Nginx编译适合自己的Nginx下载nginx nginx......
  • 用他 nginx 访我 nginx 之计(跨 nginx 访问方案)
    需求:生产环境上,我们这边网络权限他们开不了,想从被人系统的ng跳转到我们ng,这个需要怎么做?总之就是人家ng有外网权限,通过人家ng访问我们ng,然后我们用人家域名。答:如果想要通过别人项目的Nginx(简称“外网Nginx”)来访问自己环境的Nginx(简称“内部Nginx”),并且你还希望使用别人的域名,......
  • ubuntu下查看apt安装的软件包具体安装了哪些文件
    如果软件包是dpkg安装了,可以通过dpkg-L来查看已安装的软件包具体安装了哪些文件到哪些目录下。但是如果软件还未安装时,dpkg-L就无能为力了。这时就需要用apt-file命令来实现了。首先ubuntu默认不安装apt-file,先安装它sudoaptinstallapt-file-y然后更新源里面的信息,其实就......
  • Ubuntu配置开机自启动
    一、创建启动脚本创建启动脚本start_control_ros.sh#!/bin/bash#Waitforthenetworktobeup(ifneeded)sleep30#SourceyourROSsetup.bash(adjustthepathifnecessary)source/opt/ros/noetic/setup.bashsource/home/boat/duyiming_ws/devel/setup.bashe......
  • ubuntu安装findutils报错xargs: not found
    因为缺少find所以安装findutilsapt-getinstallfindutils报错说缺少xargs和find,但这俩也是属于findutils的,造成了循环依赖root@ubuntu:/home/mika#apt-getinstallfindutilsReadingpackagelists...DoneBuildingdependencytreeReadingstateinformation...DoneTh......
  • 前后端都用得上的 Nginx 日常使用经验
    前言nginx是一个高性能的开源反向代理服务器和web服务器,一般用来搭建静态资源服务器、负载均衡器、反向代理,本文将分享其在Windows/docker中的使用,使用nssm部署成服务的方案脚本,局域网中自定义域名解决https提示不安全的解决方案,以及一路踩过的坑。特点高性能:......
  • 安装虚拟机Ubuntu&配置SSH&配置samba&设置公钥
    1安装虚拟机及Ubuntu准备好Vmware16安装包和Ubuntu16.04安装包创建新的虚拟机选择自定义配置选择虚拟机硬件兼容性:默认下一步安装客户机操作系统:选择稍后安装操作系统选择客户机操作系统:选择Linux、Ubuntu64位命名虚拟机:自行修改,可默认下一步处理器配置:根据电脑配......
  • ubuntu系统安装mysql
     一、下载安装包https://downloads.mysql.com/archives/community/使用wget命令下载tar包wgethttps://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tarsudotar-xvfmysql-server_5.7.42-1ubuntu18.04_amd64.deb-bu......