全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 541|回复: 5

apache伪静态转换成nginx,来个大佬帮忙看看

[复制链接]
发表于 2023-2-10 09:20:38 | 显示全部楼层 |阅读模式
代码是下面这一段,怎么完美转成nginx的,试了很多在线转换工具都有问题

RewriteEngine On
Options +FollowSymLinks
Options -Indexes
RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule . index.php [L,QSA]

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
 楼主| 发表于 2023-2-10 10:11:34 | 显示全部楼层
自己顶一下
 楼主| 发表于 2023-2-10 11:41:43 | 显示全部楼层
再顶,等大佬
 楼主| 发表于 2023-2-10 13:56:56 | 显示全部楼层
没有大佬吗
发表于 2023-2-10 14:05:22 | 显示全部楼层
本帖最后由 whl32 于 2023-2-10 14:07 编辑

好久没接触.htaccess了,忘记了,我就看懂后面的
  1. autoindex off;

  2. autoindex off;

  3. location / {
  4.   if ($script_filename !~ "-d"){
  5.     rewrite ^(.*)$ /index.php break;
  6.   }
  7.   if ($http_host ~* "^www\.(.*)$"){
  8.     set $http_host_1 $1;
  9.     rewrite ^(.*)$ http://$http_host_1/$1 redirect;
  10.   }
  11. }
复制代码
 楼主| 发表于 2023-2-10 14:18:21 | 显示全部楼层
whl32 发表于 2023-2-10 14:05
好久没接触.htaccess了,忘记了,我就看懂后面的


谢谢,还是报错

ERROR:
nginx: [emerg] "autoindex" directive is duplicate in /www/server/web_conf/nginx/rewrite/ssxx.com.conf:3
nginx: configuration file /www/server/openresty/nginx/conf/nginx.conf test failed

nginx前面的内容是
server
{
    listen 80;
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
    listen [::]:80;
    server_name ssxx.com;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/ssxx.com;
   
    #SSL-START
    #error_page 404/404.html;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2026-1-2 06:14 , Processed in 0.235310 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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