Nginx伪静态和apache不一样,不是用.htaccess实现,而是在虚拟主机配置文件中include伪静态文件。
所以可以这样设置伪静态:
1、在discuz后台启用伪静态,查看伪静态规则,复制到一个文件,命名随意,比如discuzx25.conf。
2、将discuzx25.conf上传到/usr/local/nginx/conf/目录下。
3、在/usr/local/nginx/conf/vhost/目录下找到虚拟主机配置文件,比如abc.com.conf,操作如下:
1 |
vim abc.com.conf |
1 2 3 4 5 6 7 8 |
server { listen 80; server_name abc.com; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/abc.com; include discuzx25.conf; |
最后重启nginx
1 |
/etc/init.d/nginx restart |
未经许可,禁止转载。
本文链接地址: https://www.annhe.net/article-1048.html
发表评论