zoukankan      html  css  js  c++  java
  • Nginx下Magento伪静态规则,适用于LNMP一键包

    文件名为:magento.conf(下载),将其放在 /usr/local/nginx/conf/ 文件夹下 
    然后在 /usr/local/nginx/conf/vhost/www.yourname.com.conf 中将include none.conf; 换成include magento.conf;即可。" B3 M( l8 {! g  e7 N
    ( ~) ^+ j  [1 M+ ~) b' K+

    [plain] view plaincopy
     
    1. location / {  
    2.         index index.html index.php; ## Allow a static html file to be shown first  
    3.         try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler  
    4.         expires 30d; ## Assume all files are cachable  
    5.     }  
    6.   
    7.     ## These locations would be hidden by .htaccess normally  
    8.     location /app/                { deny all; }  
    9.     location /includes/           { deny all; }  
    10.     location /lib/                { deny all; }  
    11.     location /media/downloadable/ { deny all; }  
    12.     location /pkginfo/            { deny all; }  
    13.     location /report/config.xml   { deny all; }  
    14.     location /var/                { deny all; }  
    15.   
    16.     location /var/export/ { ## Allow admins only to view export folder  
    17.         auth_basic           "Restricted"; ## Message shown in login window  
    18.         auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword  
    19.         autoindex            on;  
    20.     }  
    21.       location  /. { ## Disable .htaccess and other hidden files  
    22.         return 404;  
    23.     }  
    24.   
    25.     location @handler { ## Magento uses a common front handler  
    26.         rewrite / /index.php;  
    27.     }  
    28.   
    29.     location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler  
    30.         rewrite ^(.*.php)/ $1 last;  
    31.     }  



    最后是重启nginx:  k! {' D2 |9 a4 r4 `&
    ( 3 u" T2 J/ s' B; l

    /etc/init.d/nginx restart

    /usr/local/nginx/sbin/nginx -s reload

    Flag Counter
  • 相关阅读:
    Navicat12激活,最新版本v12.1.18,原版激活[windows]
    【工具】Fiddler使用教程
    MongoDB笔记
    MongoDB
    MySQL三层结构、用户权限、索引设计原则
    Ajax
    linux简单优化
    linux基本
    Memcached
    Django+Uwsgi+Nginx
  • 原文地址:https://www.cnblogs.com/sunsoftware/p/4602008.html
Copyright © 2011-2022 走看看