2013-03-25 12 views
9

Kann OpenCart SEO URLs auf nginX verwenden? Ich verstehe, dass in Apache ein .htaccess erstellt wird, aber ist es in der Lage, die URL-Umleitung in nginX automatisch zu verwalten?OpenCart auf nginX

+0

Was hält Sie davon ab? – shadyyx

Antwort

16

OpenCart auf Nginx - Wir verwenden es seit einem Jahr. Endlich scheinen andere Leute damit angefangen zu haben. Hilfe zu bekommen ist ein Alptraum und auf Nginx in immer ist manchmal schwierig ..

Mein www.site.com.vhost unten ist, Beispiel:

# 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, jetzt in Bezug auf Ihre Website zu verwalten. Sie können nun SEO über den Admin, siehe meine anderen Beiträge tagged nginx and opencart für alle URLs und die weitere Anpassung der location/{}

aktiviere ich über das Entfernen der index.php Lesen auch empfehlen route = - Link unten:

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

+1

nette Antwort, +1 –

+0

Ich wäre auch vorsichtig mit dem 'audioindex on;' Dies ist aufgrund der Verwendung eines CDN und es wäre am besten, diese Ordner privat zu halten. – TheBlackBenzKid

+0

Können Sie bitte Ihre Einrichtung detaillierter ausführen. Ich habe versucht, Ihre Konfiguration zu verwenden, aber es scheint überhaupt nicht zu funktionieren. Ich vermisse Hintergrundinformationen über dein FastCGI-Setup usw. etc. –