2013-03-25 19 views
9

OpenCart può utilizzare gli URL SEO su nginX? Capisco che in Apache, crea un .htaccess, ma è in grado di gestire automaticamente il reindirizzamento dell'URL in nginX?OpenCart on nginX

+0

Cosa ti impedisce di provare? – shadyyx

risposta

16

OpenCart on Nginx - Lo usiamo da un anno. Finalmente sembra che altre persone inizino a usarlo. Richiesta di aiuto è un incubo e sempre in su Nginx è a volte difficile ..

mio www.site.com.vhost è inferiore, ad esempio:

# FORCE WWW 
server { 
    server_name site.com; 
    rewrite ^(.*) http://www.site.com$1 permanent; 
} 
# MAIN SERVER 
# NINX 0.8.54 - WORKS ON 1.1.19 
server { 
    server_name www.site.com; 
    listen 80; 
    root /var/www/www.site.com/web; 
    index index.php index.html; 
    location /image/data { 
     autoindex on; 
    } 
    location /admin { 
     index index.php; 
    } 
    location/{ 
     try_files $uri @opencart; 
    } 
    location @opencart { 
     rewrite ^/(.+)$ /index.php?_route_=$1 last; 
    } 
    location = /favicon.ico { 
     log_not_found off; 
     access_log off; 
    } 
    location = /robots.txt { 
     allow all; 
     log_not_found off; 
     access_log off; 
    } 
    # 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; 
    } 
    location ~ \.php$ { 
     try_files $uri =404; 
     include /etc/nginx/fastcgi_params; 
     fastcgi_pass 127.0.0.1:9000; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    } 
} 

OK, ora per quanto riguarda la gestione del sito. A questo punto è possibile attivare SEO tramite l'amministratore, vedere i miei altri post tagged nginx and opencart per tutti gli URL e le ulteriori personalizzazioni con il location/{}

vi consiglio anche la lettura sulla rimozione del index.php percorso = - link qui sotto:?

Remove index.php?route=common/home from OpenCart

+1

nice answer, +1 –

+0

Vorrei anche essere cauto con 'audoindex on;' questo è dovuto al fatto che usiamo un CDN e sarebbe meglio mantenere queste cartelle private. – TheBlackBenzKid

+0

Puoi per favore elaborare la tua installazione più in dettaglio. Ho provato a usare la tua configurazione, ma non sembra funzionare affatto. Mi mancano le informazioni sul backgroud sulla configurazione FastCGI, ecc. Ecc. –