Hello, I am trying to rewrite for a webpage, some stuff from apache to
nginx, somehow I am not doing it right coz its not working... Can some
one help me to rewrite this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
RewriteRule ^(.*/)?\.svn(/|$) - [F,L]
RewriteRule ^(.*/)?api(/|$) - [F,L]
RewriteRule ^(.*/)?libs(/|$) - [F,L]
RewriteRule ^(.*/)?plugins(/|$) - [F,L]
RewriteRule ^(.*/)?storage(/|$) - [F,L]
RewriteRule ^(.*/)?templates(/|$) - [F,L]
to nginx?!
Thank you!
on 29.08.2008 10:54
on 29.08.2008 11:08
On Fri, Aug 29, 2008 at 10:54:38AM +0200, Robert Gabriel wrote: > RewriteRule ^(.*/)?libs(/|$) - [F,L] > RewriteRule ^(.*/)?plugins(/|$) - [F,L] > RewriteRule ^(.*/)?storage(/|$) - [F,L] > RewriteRule ^(.*/)?templates(/|$) - [F,L] > > to nginx?! server { root ... location / { error_page 404 = /index.php; } location ~* \.php$ { ... } location ~* ^(.*/)?(\.svn|api|libs|plugins|storage|templates)(/|$) { return 403; }
on 29.08.2008 11:13
But what about this?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Igor Sysoev wrote:
> On Fri, Aug 29, 2008 at 10:54:38AM +0200, Robert Gabriel wrote:
>
>> RewriteRule ^(.*/)?libs(/|$) - [F,L]
>> RewriteRule ^(.*/)?plugins(/|$) - [F,L]
>> RewriteRule ^(.*/)?storage(/|$) - [F,L]
>> RewriteRule ^(.*/)?templates(/|$) - [F,L]
>>
>> to nginx?!
>
> server {
>
> root ...
>
> location / {
> error_page 404 = /index.php;
> }
>
> location ~* \.php$ {
> ...
> }
>
> location ~* ^(.*/)?(\.svn|api|libs|plugins|storage|templates)(/|$) {
> return 403;
> }
on 29.08.2008 11:24
On Fri, Aug 29, 2008 at 11:13:20AM +0200, Robert Gabriel wrote: > But what about this? > > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > RewriteRule . index.php [L] location / { error_page 404 = /index.php; }
on 29.08.2008 11:28
Igor Sysoev wrote: > On Fri, Aug 29, 2008 at 11:13:20AM +0200, Robert Gabriel wrote: > >> But what about this? >> >> RewriteCond %{REQUEST_FILENAME} !-f >> RewriteCond %{REQUEST_FILENAME} !-d >> RewriteRule . index.php [L] > > location / { > error_page 404 = /index.php; > } It doesnt work, I was thinking to do it like this: if (!-f $request_filename) { rewrite . /index.php last; break; } But this doesnt work eider, the website doesnt seems to work and if I dont use any rewrite rules I get 404 error and if I use the rules, its just messed up.
on 29.08.2008 11:39
On Fri, Aug 29, 2008 at 11:28:03AM +0200, Robert Gabriel wrote: > > error_page 404 = /index.php; > > } > > It doesnt work, I was thinking to do it like this: > > if (!-f $request_filename) { > rewrite . /index.php last; > break; > } No, do not use this. > But this doesnt work eider, the website doesnt seems to work and if I > dont use any rewrite rules I get 404 error and if I use the rules, its > just messed up. Could you show your configuration ?
on 29.08.2008 11:41
The subdomain config:
server {
listen 80;
server_name helpdesk.visualserver.org *.helpdesk.visualserver.org;
access_log /var/log/nginx/helpdesk-access_log;
error_log /var/log/nginx/helpdesk-error_log;
location / {
root /srv/www/helpdesk;
index index.php index.html index.htm;
error_page 404 = /index.php;
}
location ~* ^(.*/)?(\.svn|api|libs|plugins|storage|templates)(/|$) {
return 403;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:50000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/srv/www/helpdesk$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with
--enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/nginx-default;
}
}
nginx config:
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
server_names_hash_bucket_size 128;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 4;
gzip on;
gzip_min_length 1100;
gzip_comp_level 2;
gzip_types text/plain text/html text/css;
include /etc/nginx/sites-enabled/*;
include /etc/nginx/sites-users/*;
include /etc/nginx/sites-virtual/*;
}
So thats about it...
on 29.08.2008 12:12
On Fri, Aug 29, 2008 at 11:41:51AM +0200, Robert Gabriel wrote: > The subdomain config: Does simple http://helpdesk.visualserver.org/index.php work ? Probably you need to move root /srv/www/helpdesk; to server level to inherit it in "location ~* \.php$" and to get right $document_root variable in fastcgi_param. PS. looking at these indentions I'm starting to understand python more and more.
on 29.08.2008 12:46
Igor Sysoev wrote: > On Fri, Aug 29, 2008 at 11:41:51AM +0200, Robert Gabriel wrote: > >> The subdomain config: > > Does simple http://helpdesk.visualserver.org/index.php work ? > > Probably you need to move > root /srv/www/helpdesk; > to server level to inherit it in "location ~* \.php$" and to get > right $document_root variable in fastcgi_param. > > PS. looking at these indentions I'm starting to understand python more > and more. Yes http://helpdesk.visualserver.org/index.php works, but when I try to login everything starts to be screwed up.
on 29.08.2008 13:08
On Fri, Aug 29, 2008 at 12:46:12PM +0200, Robert Gabriel wrote: > > right $document_root variable in fastcgi_param. > > > > PS. looking at these indentions I'm starting to understand python more > > and more. > > Yes http://helpdesk.visualserver.org/index.php works, but when I try to > login everything starts to be screwed up. The login page POSTs to /index.php/, then browser gets various URLs like: /index.php/styles/default/cerberus.css?v=726 Is it correct ?
on 29.08.2008 13:10
Igor Sysoev wrote: > On Fri, Aug 29, 2008 at 12:46:12PM +0200, Robert Gabriel wrote: > >> > right $document_root variable in fastcgi_param. >> > >> > PS. looking at these indentions I'm starting to understand python more >> > and more. >> >> Yes http://helpdesk.visualserver.org/index.php works, but when I try to >> login everything starts to be screwed up. > > The login page POSTs to /index.php/, then browser gets various URLs > like: > /index.php/styles/default/cerberus.css?v=726 > > Is it correct ? Yeah something like that, or http://helpdesk.visualserver.org/index.php/login
on 29.08.2008 13:37
On Fri, Aug 29, 2008 at 01:10:47PM +0200, Robert Gabriel wrote: > > > > The login page POSTs to /index.php/, then browser gets various URLs > > like: > > /index.php/styles/default/cerberus.css?v=726 > > > > Is it correct ? > > Yeah something like that, or > http://helpdesk.visualserver.org/index.php/login Then you need to change - location ~* \.php$ { + location ~* \.php(/|$) {
on 29.08.2008 13:45
Done that, doesnt work, I really cant get the idea why it doesnt work... This is shitty :( P.S. this is cerb4 (cerberus helpdesk)
on 29.08.2008 14:02
Robert Gabriel wrote: > Done that, doesnt work, I really cant get the idea why it doesnt work... > What is in a error log ?
on 29.08.2008 14:07
Actually in /var/log/nginx/helpdesk-error_log I dont have any errors and in access_log seems everything ok.
on 29.08.2008 14:14
On Fri, Aug 29, 2008 at 01:45:59PM +0200, Robert Gabriel wrote: > Done that, doesnt work, I really cant get the idea why it doesnt work... > This is shitty :( > > P.S. this is cerb4 (cerberus helpdesk) Then you probably need to add PATH_INFO: location ~* \.php(/|$) { set $path_info ""; if ($uri ~ \.php(/.+)$) { set $path_info $1; } ... fastcgi_param PATH_INFO $path_info; ... }
on 29.08.2008 14:16
set $path_info ""; this blank or where the scripts are?
on 29.08.2008 14:18
I suppose something like this:
location ~* \.php(/|$) {
fastcgi_pass 127.0.0.1:50000;
fastcgi_index index.php;
set $path_info "";
if ($uri ~ \.php(/.+)$) {
set $path_info $1;
}
fastcgi_param SCRIPT_FILENAME
/srv/www/helpdesk$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
on 29.08.2008 15:35
On Fri, Aug 29, 2008 at 02:18:36PM +0200, Robert Gabriel wrote: > /srv/www/helpdesk$fastcgi_script_name; > fastcgi_param PATH_INFO $path_info; > fastcgi_param QUERY_STRING $query_string; > fastcgi_param REQUEST_METHOD $request_method; > fastcgi_param CONTENT_TYPE $content_type; > fastcgi_param CONTENT_LENGTH $content_length; > } Yes.
on 29.08.2008 16:18
Good, it doesnt work :)
on 29.08.2008 16:34
On Fri, Aug 29, 2008 at 04:18:52PM +0200, Robert Gabriel wrote:
> Good, it doesnt work :)
Could you create debug log ?
on 29.08.2008 21:39
Well like how, even if i set nginx to debug I wont have any "error" or something like that. So let me know how...
on 01.09.2008 09:59
Hello, nobody else can help out with this weird issue? Does anyone uses, or used Cerberus Helpdesk with nginx? Please let me know, its really important ... Thanks!
on 01.09.2008 12:12
Hi, if you create a debug log it will help Igor S and others to understand what's going on under the hood, and possibly fix the problem. Compile nginx with --with-debug and set the log level in your nginx.conf to 'debug', and you''ll see a great deal of data in the log files. cheers, Igor On 29 Aug 2008, at 20:39, Robert Gabriel wrote: > Well like how, even if i set nginx to debug I wont have any "error" or > something like that. So let me know how...
on 01.09.2008 18:35
Ok so please check the attachement, I rebuild nginx with --with-debug and enable debug in the helpdesk subdomain/vhost, as u wish. Please let me know if u can help me out. Please download it from here, coz its to big. http://www.visualserver.org/helpdesk-error_log.gz
on 05.09.2008 11:44
What about this issue, has anybody some ideas or fixed?!