宝塔724运维节来了,企业版999元/年,送安全巡检;证书组队,低至28元!查看活动
当前位置:论坛首页 > Linux面板 > 求助

【已解答】如何将其他人提供的URL重写改写为宝塔内的伪静

发表在 Linux面板2023-1-31 05:05 [复制链接] 1 4081

我在安装某个不知名的CMS,然后安装时提示我需要配置nginx的URL重写并提供了文档和规则,但是请问如何将这段规则写入宝塔的伪静态,文档提供的规则如下:
  1. <pre tabindex="0"><code>server {
  2.     listen 80;
  3.     server_name example.com;
  4.     root /var/www/azuriom/public;

  5.     add_header X-Frame-Options "SAMEORIGIN";
  6.     add_header X-XSS-Protection "1; mode=block";
  7.     add_header X-Content-Type-Options "nosniff";
  8.     add_header Referrer-Policy "strict-origin-when-cross-origin";

  9.     index index.html index.htm index.php;

  10.     charset utf-8;

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

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

  16.     error_page 404 /index.php;

  17.     location ~ \.php$ {
  18.         fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
  19.         fastcgi_index index.php;
  20.         fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  21.         include fastcgi_params;
  22.     }

  23.     location ~ /\.(?!well-known).* {
  24.         deny all;
  25.     }
  26. }</code></pre>
复制代码
文档里还在下方提示了:This configuration must be placed in a site in site-available and not in thenginx.conf.

请问我该如何把这段规则写入伪静态?谢谢

使用的是php8.2


使用道具 举报 只看该作者 回复
发表于 2023-1-31 12:09:17 | 显示全部楼层
  1.     location / {
  2.         try_files $uri $uri/ /index.php?$query_string;
  3.     }
复制代码

把这部分放到网站伪静态那里,图里的内容和你的内容无关 伪静态添加配置.png
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表