rewrite
Николай Николов Howto chevereto, clip-bucket, clipbucket, Directive Snippets, ispconfig, nginx, opencart, rewrite, seo, wordpress, yourls 0 comments
ISPConfig Directive Snippets for nginx
Това са моите снипети за nginx (nginx rewrite urls) които използвам в ISPConfig:
Yourls rewrite за yourls
try_files $uri $uri/ /yourls-loader.php;
Chevereto rewrite – best images script in the web – chevereto
location / { index index.php; client_max_body_size 30m; client_body_buffer_size 128k; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php last; } } location /admin { try_files $uri /admin/index.php?$args; }
WordPress nginx rewrite – wordpress
try_files $uri/ $uri /index.php?q=$uri&$args;
За opencart , вижте тази публикация
А за clip-bucket, прочетете тази публикация.
Николай Николов Работа, Howto clip-bucket, clipbucket, clipbucket problem, ispconfig, nginx, rewrite, upload 0 comments
clip-bucket ,nginx and rewrite ceo urls
От доста време се опитвам да открия успешен вариянт да подкарам clip-bucket под nginx с работещ rewrite. Останах с лошо впечетление, след като прочетох във форума на clip-bucket че всичко според тях работело идеално за apache но не и за nginx и LiteSpeed. Е.. аз открих пък вариянт в който всичко да работи на nginx!
Ето работещите правила които трябва да се добавят в конфига на виртуалния хост:
location /videos { rewrite ^/videos/(.*)/(.*)/(.*)/(.*)/(.*) /videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2; rewrite ^/videos/([0-9]+) /videos.php?page=$1; rewrite ^/videos/?$ /videos.php?$query_string; } location /video { rewrite ^/video/(.*)/(.*) /watch_video.php?v=$1&$query_string; rewrite ^/video/([0-9]+)_(.*) /watch_video.php?v=$1&$query_string; } location / { rewrite ^/(.*)_v([0-9]+) /watch_video.php?v=$2&$query_string; rewrite ^/([a-zA-Z0-9-]+)/?$ /view_channel.php?uid=$1&seo_diret=yes; } location /channels { rewrite ^/channels/(.*)/(.*)/(.*)/(.*)/(.*) /channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2; rewrite ^/channels/([0-9]+) /channels.php?page=$1; rewrite ^/channels/?$ /channels.php; } location /members { rewrite ^/members/?$ /channels.php; } location /users { rewrite ^/users/?$ /channels.php; } location /user { rewrite ^/user/(.*) /view_channel.php?user=$1; } location /channel { rewrite ^/channel/(.*) /view_channel.php?user=$1; } location /my_account { rewrite ^/my_account /myaccount.php; } location /page { rewrite ^/page/([0-9]+)/(.*) /view_page.php?pid=$1; } location /search { rewrite ^/search/result/?$ /search_result.php; } location /upload { rewrite ^/upload/?$ /upload.php; } location /contact { rewrite ^/contact/?$ /contact.php; } location /categories { rewrite ^/categories/?$ /categories.php; } location /group { rewrite ^/group/([a-zA-Z0-9].+) /view_group.php?url=$1&$query_string; } location /view_topic { rewrite ^/view_topic/([a-zA-Z0-9].+)_tid_([0-9]+) /view_topic.php?tid=$2&$query_string; } location /groups { rewrite ^/groups/(.*)/(.*)/(.*)/(.*)/(.*) /groups.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2; rewrite ^/groups/([0-9]+) /groups.php?page=$1; rewrite ^/groups/?$ /groups.php; } location /create_grou { rewrite ^/create_group /create_group.php; } location /collections { rewrite ^/collections/(.*)/(.*)/(.*)/(.*)/(.*) /collections.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2; rewrite ^/collections/([0-9]+) /collections.php?page=$1; rewrite ^/collections/?$ /collections.php; } location /photos { rewrite ^/photos/(.*)/(.*)/(.*)/(.*)/(.*) /photos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2; rewrite ^/photos/([0-9]+) /photos.php?page=$1; rewrite ^/photos/?$ /photos.php; } location /collection { rewrite ^/collection/(.*)/(.*)/(.*) /view_collection.php?cid=$1&type=$2&$query_string; } location /item { rewrite ^/item/(.*)/(.*)/(.*)/(.*) /view_item.php?item=$3&type=$1&collection=$2; } location /photo_upload { rewrite ^/photo_upload/(.*) /photo_upload.php?collection=$1; rewrite ^/photo_upload/?$ /photo_upload.php; } location = /sitemap.xml { rewrite ^(.*)$ /sitemap.php; } location /signup { rewrite ^/signup/?$ /signup.php; } location = /rss { rewrite ^(.*)$ /rss.php; } location /rss { rewrite ^/rss/([a-zA-Z0-9].+)$ /rss.php?mode=$1&$query_string; }
Така можем да ползваме пълноценно всичките екстри на clip-bucket!
Тъй като се натъкнах и на още един проблем , а именно качването на големи файлове в сайта , ето и решение на проблема.
Грешката която видях в лога на nginx-a е следната :
client intended to send too large body:
Тъй като ползвам ISPconfig , останових че чрез стандартните настройки на php.ini или увеличяването на ъплоад размера не се получиха нещата , открих странен трик за решаване на този проблем. Поставих client_max_body_size 900M; в nginx.conf в секция http {}
Воала.. вече мога и да ъплоадвам 🙂
Николай Николов Howto nginx, opencart, problem, rewrite, seo 1 comment
opencart nginx rewrite rules problem
To get working seo urls in opencart powered by nginx you need to put some special rules in your website conf in nginx directory.
First , we need go put this files in our conf:
location / { try_files $uri @opencart; } location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }
Now we have working seo urls 🙂
Ok, but I found problem, with this settings my /admin directory now is not working and the web server says : Not found 404
To fix this we need to put :
location /admin index index.php; }
before up rule and the config will looks like this:
location /admin { index index.php; } location / { try_files $uri @opencart; } location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }
That’s it 🙂