本帖最后由 keyboardman 于 2019-6-5 10:39 编辑
由于接触到magento2项目,想试试宝塔装,网上没有相关的伪静态代码提供,于是我自己写了一份,经过测试可用
- 环境:php7.0.33; nginx1.16.0; MySQL 10.1.39-MariaDB;
- magento版本:2.1.2
复制代码 接下来附上我的代码:
- location / {
- index index.html index.php; ## Allow a static html file to be shown first
- try_files $uri $uri/ @handler;
- expires 30d;
- }
- location /var/export/ { ## Allow admins only to view export folder
- auth_basic "Restricted"; ## Message shown in login window
- auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
- autoindex on;
- }
- location /. { ## Disable .htaccess and other hidden files
- return 404;
- }
- location @handler { ## Magento uses a common front handler
- rewrite / /index.php;
- }
- location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
- rewrite ^(.*.php)/ $1 last;
- }
复制代码 官方也可以采纳下,顺提一下,伪静态选项多了,可以做个分类目录,然后选择对应的框架哦!
|
|