- 积分
- 117977
- 威望
-
- 金钱
-
- 注册时间
- 2009-4-24
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
发表于 2018-4-9 09:54:46
|
显示全部楼层
从网上找到的opencart 2.1版本的,修改后的完整虚拟主机配置如下
- server {
- server_name 域名;
- root /home/wwwroot/网站目录;
- index index.php index.html;
- listen 80;
- include enable-php.conf;
- location /image/data {
- autoindex on;
- }
- location /admin {
- index index.php;
- }
- location / {
- try_files $uri @opencart;
- }
- location @opencart {
- rewrite ^/(.+)$ /index.php?_route_=$1 last;
- }
-
- # Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
- location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
- deny all;
- }
- # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
- location ~ /\. {
- deny all;
- access_log off;
- log_not_found off;
- }
- location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
- expires max;
- log_not_found off;
- }
-
- access_log /home/wwwlog/域名.log;
- }
复制代码
好像有说需要开pathinfo的,如果要pathinfo的话把 include enable-php.conf; 改成 include enable-php-pathinfo.conf; |
|