EdgarsK Posted September 6, 2010 Report Share Posted September 6, 2010 Sveiki, lietoju subdomain.domain.com ar CI (Codeigniter). Apache gadijumā, lai CI veiksmīgi darbotos, neteikšu ka vienmēr, nepieciešams htaccess. Lūk ejošs variants [.htacess] <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^scripts.* RewriteRule ^(.*)$ /index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 /index.php </IfModule> Bet pārejot uz nginx, sastopos ar zināmām grutībām pārfrāzēt šo rewrite uz nginx saprotamu vidi. 1) Vajadzētu sarpast, kurā failā kas tiek rakstīts - vai ir kāds kopīgais fails kurā tiek rakstīts tas, ko agrāk apacī rakstija atseviški htaccess failos ? 2) Kā šo apache htaccess failu iedarbināt uz nginx ? Quote Link to comment Share on other sites More sharing options...
marrtins Posted September 6, 2010 Report Share Posted September 6, 2010 nginx'am nav htaccess. Skaties nginx rewrite: http://wiki.nginx.org/NginxHttpRewriteModule#rewrite Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted September 6, 2010 Author Report Share Posted September 6, 2010 kur tieši atrodas šis direktīvas, kur man tās jāraksta iekša ? Quote Link to comment Share on other sites More sharing options...
marrtins Posted September 6, 2010 Report Share Posted September 6, 2010 Iekš server { } Piemēram tā: server { [i]<te visāda draza server_name listen utt>[/i] if ($request_uri ~ ^scripts.*) { rewrite ^(.*)$ /index.php/$1 last; } } Vienīgi es tagad uz sitiena neatceros, kā tur bija ar tiem ~ - to tajā wiki var atrast. Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted September 7, 2010 Author Report Share Posted September 7, 2010 1) Ja veru adresi www.xxx.lv/ man palaizas kautkads "download" file, bet tur ir jabut baltai lapai 2) Ja veru adresi www.xxx.lv/test1/test2/test3 paradas redirekts www.xxx.lv/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php//test1/test2/test3 location / { proxy_pass http://xxx.xxx.xxx.xxx:8080; proxy_redirect http://xxx.lv:8080/ /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; if (-f $request_filename) { expires 30d; break; } if (!-e $request_filename) { rewrite . /index.php last; } } ########################## ( Fast CGI ) ########################################################################### #location ~ \.php$ { ### # fastcgi_pass 127.0.0.1:9000; ### # fastcgi_index index.php; ### # include /etc/nginx/fastcgi.conf; ### # fastcgi_param SCRIPT_FILENAME /var/xxxx.lv/index.php; ### #} ### ################################################################################################################### Quote Link to comment Share on other sites More sharing options...
marrtins Posted September 7, 2010 Report Share Posted September 7, 2010 Man šķiet, ka "RewriteRule ^(.*)$ index.php/$1 [L]" un "rewrite . /index.php last;" nebūs viens un tas pats. Manā dotajā piemērā jau arī nav notestēts, bet nu uz to pusi jau ir. Beigās vēl neaizmirsti par scripts rulli, bet vispirms, protams, jāpiedabūt, lai pārējais darbotos. if (!-e $request_filename) { rewrite ^(.*)$ /index.php/$1 last; } Tas gan jātastē, jo tam nginx visādi triki mēdz izlīst atkarībā no "root" Quote Link to comment Share on other sites More sharing options...
marrtins Posted September 10, 2010 Report Share Posted September 10, 2010 Btw, Tev šis iet uz FastCGI vai vnk proxy uz Apache? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.