Quantcast
Channel: Nginx Forum - How to...
Viewing all 2931 articles
Browse latest View live

Nginx + fast-cgi + seafile (no replies)

$
0
0
Hi all,

I've recently installed nginx on my RPi and want to use it to host my seafile server but I am not an expert at reading/writing .conf files well.

My nginx.conf file currently:

##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

http {

location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_cache one;
fastcgi_cache_min_uses 3;
fastcgi_cache_valid 200 301 302 304 5m;
fastcgi_cache_key "$request_method|$host|$request_uri";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort off;

client_header_timeout 3000;
client_body_timeout 3000;
fastcgi_read_timeout 3000;
client_max_body_size 0;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;

server {
listen 80;
server_name tr0n.dnsdynamic.net:8001;
rewrite ^/(.*) https://$server_name/$1 permanent; # force redirect http to https
}

server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/seahub.crt;
ssl_certificate_key /etc/nginx/ssl/seahub.key;
server_name tr0n.dnsdynamic.net:8001

location / {
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;

fastcgi_param SERVER_PROTOCOL $server_protocol;
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 SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;

access_log /var/log/nginx/seahub.access.log;
error_log /var/log/nginx/seahub.error.log;

}

location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
}

location /media {
root /home/pi/seafile_installer/seafile-server-latest/seahub;
}
}

}


I would liket to set up NGINX with fast-cgi, php-fqm and my seafile server.

Thanks in advance!

Upload through nginx cut at 64K (no replies)

$
0
0
I am trying to upload files through nginx proxy_pass to a nodejs server.

My location looks like this:

location /upload {
proxy_pass http://127.0.0.1:8080;
chunked_transfer_encoding on;
proxy_buffering off;
client_max_body_size 10M;
}

It works ok for files smaller than 64K, but for larger files, only the first 64K is received by the nodejs server. If I upload directly to the nodejs server it works as expected.

I get this error in the nginx error log:

2014/07/25 09:01:53 [error] 39397#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading upstream, client: 127.0.0.1, server: localhost, request: "PUT /upload/henrik/test.jpg HTTP/1.1", upstream: "http://127.0.0.1:8080/upload/henrik/test.jpg", host: "localhost"

Though the client seems to think it goes well:

$ curl -I --upload-file testdata/test.jpg localhost:8080/upload/henrik/test.jpg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Fri, 25 Jul 2014 07:04:11 GMT
Connection: keep-alive
Transfer-Encoding: chunked

100 2213k 0 0 100 2213k 0 21.9M --:--:-- --:--:-- --:--:-- 21.8M

Nginx alias or root migrate from apache (no replies)

$
0
0
Hi,

Could you help me write nginx config for roundcube?

I have configured location as below and as result scripts path is /var/lib/roundcube/webmail/info.php should be /var/lib/roundcube/info.php

How to should configure for have `fastcgi param: "SCRIPT_FILENAME: /var/lib/roundcube/info.php"`

```
location /webmail {
alias /var/lib/roundcube;
index index.php index.html index.htm;
try_files $uri =404;
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 SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
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 GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
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;
fastcgi_param HTTPS $https;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
```

```
2014/07/27 09:49:14 [debug] 6175#0: *1 trying to use file: "/info.php" "/var/lib/roundcube/info.php"
2014/07/27 09:49:14 [debug] 6175#0: *1 cached open file: /var/lib/roundcube/info.php, fd:20, c:1, e:0, u:1
2014/07/27 09:49:14 [debug] 6175#0: *1 http script var: "/var/lib/roundcube/info.php"
2014/07/27 09:49:14 [debug] 6175#0: *1 fastcgi param: "SCRIPT_FILENAME: /var/lib/roundcube/info.php"
2014/07/27 09:49:14 [debug] 6175#0: *1 http script var: "/var/lib/roundcube"
2014/07/27 09:49:14 [debug] 6175#0: *1 fastcgi param: "DOCUMENT_ROOT: /var/lib/roundcube"
2014/07/27 09:49:14 [debug] 6175#0: *1 http script var: "/var/lib/roundcube"
2014/07/27 09:49:14 [debug] 6175#0: *1 fastcgi param: "SCRIPT_FILENAME: /var/lib/roundcube/webmail/info.php"
2014/07/27 09:49:14 [debug] 6175#0: *1 close cached open file: /var/lib/roundcube/info.php, fd:20, c:0, u:1, 0
```

Configuring NGINX to serve Ruby on Rails and Drupal websites (no replies)

$
0
0
As I try to migrate my Drupal website from Bluehost to DigitalOcean, I am encountering difficulties with my Nginx setup.

I have a live Ruby on Rails app living in ~/Kiji and I'd like for the Drupal one to go into ~/asia-gazette.

Here is my current nginx.conf file (which isn't configured properly as I do not understand exactly what I need to change). Someone suggested I do not need multiple server block but rather multiple location blocks in the same server, which makes sense but I do not know how to configure it if that's the case (I've taken the setup from a tutorial on DigitalOcean). Any help with this is much appreciated!


worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}

http {

passenger_root /home/dani/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48;
passenger_ruby /home/dani/.rvm/gems/ruby-2.1.2/wrappers/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

## Ruby on Rails app
server {
listen 80;
server_name localhost;
passenger_enabled on;
root /home/dani/Kiji/public;

location ~ ^/(assets)/ {
expires max;
add_header Cache-Control public;
gzip_static on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

## Drupal app
server {
listen 80;

root /home/dani/asia-gazette;
index index.php;

server_name localhost/asia-gazette;

location / {
try_files $uri $uri/ =404;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/dani/asia-gazette;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
}

Folders in same level (Joomla + HRM) (no replies)

$
0
0
Hello Everyone,

I have:
..public_html\abc - Joomla (mais website)
..public_html\hrm - OragemHRM
..public_html\test - generic php folder

Nginx Conf
server{
....
root /home/public_html/abc;
index index.php index.html index.htm default.html default.htm;

location / {
try_files $uri $uri/ /index.php?q=$request_uri;
}

location /test {
root /home/public_html;
}

# Config form OrangeHRM
location /hrm {
root /home/public_html;
}

location /sf/ {
root /home/public_html/hrm/symphony/lib/vendor/symfony/data/web/;
}


Using this configuration, Joomla works fine (location /) but the others locations (folders) doesn't.
if i change the server root from:
root /home/public_html/abc;
to
root /home/public_html;

All folders (hrm and generic php) works fine, but joomla doesn't!
How can I control root's config for different locations?

In my old nginx server I had every folder inside joomla folder (like public_html\abc\hrm) - and everything worked great but for administration it was complicated.

Very thanks

Nginx load balancer replicate traffic to upstream server (no replies)

$
0
0
I have nginx loadbalancers accept Post data and send to upstream application servers (Roundrobin) using fastcgi. Now, I would like to replicate traffic to different set of cluster. How do I do that in nginx?

Post traffic --> Nginx LB --> Cluster 1
...........................|
...........................v
....................Cluster 2

Cluster 1 and 2 should receive same events.

In my case user send post traffic once and Nginx should be able to replicate (replay) traffic to Cluster 1 and 2.

OCSP stapling cache (no replies)

$
0
0
Hello,
I'm facing the problem with NGINX 1.6.0 and OCSP stapling.
First request of the OCSP request is returning no response (I understand that is an known issue) and this can be fixed by running request when NGINX start, restart or reload configuration so next requests will return correct response.
However after issuing the OCSP request after more than 1 hour (cache expiration) will lead to strange functionality:
1. First request will return correct response
2. Second request will return no response

How can I overcome this issue?
Suppose I run job each hour that will make requests to NGINX OCSP stapling but in this case how can I be sure that next request will return correct response.
Moreover how can I change the functionality that first request also will return the correct response?

Thanks,
Evgeny

Nginx 1.6.0 How to stop %2B to be normalized to + ? (no replies)

$
0
0
I have a setup in which nginx works as a proxy for couchdb.
With this setup I cannot retrieve an attachment with a + in the filename.

Example:
I want to retrieve file "one+name.jpg" from the server.
I do these requests:
curl 'http://example.com/database/document/one%2Bname%20tester.jpg'
In the couchdb logs I see this:
GET /database/document/one+name%20tester.jpg

The space character that is urlencoded to %20 is not decoded when passed to couchdb.
The + character that is urlencoded to %2B get decoded to + when passed to couchdb.

Since couchdb expects + to be urlencoded I get an error ('document not found').

--------
Nginx configuration:
location / {
proxy_buffering off;
proxy_connect_timeout 600s;
proxy_read_timeout 600s;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:5984/;
}
--------

IMAP Forwarder - Newbie (no replies)

$
0
0
Hi all, I am completely new to nginx. All of my family members use email addresses at one of my domains (hosted in another country). Recently, the hosting company transferred my account to a different server, with a different IP address. This IP is currently blacklisted (no idea why) at the ISP that my father connects through. My ISP has no problems communicating with the server.

What I am hoping to do with nginx is set it up on my computer (Windows 7 with a domain name attached to it) and have my father connect to my computer to send and receive email. The server he needs to connect to uses IMAP with SSL on port 993 and SMTP with SSL on port 465.

Is it possible for me to configure the Windows version of the software to forward everything to the remote mail server (including authentication) so that he doesn't need to use an IP which is blocked to him?

I need things to be as simple for him as possible, and am hoping that all I need him to do is to change the server address from remotehost.com to mypersonal.co.uk. At present, he is having to use his mobile phone to download his email over the air (which is not cheap), and his ISP says it can take up to a month to get the IP address unblocked.

Any help would be greatly appreciated.

why localhost/phpmyadmin redirect to my drupal site (no replies)

$
0
0
i installed drupal , nginx , php-fpm on my ubuntu desktop

and if i'm go to http://localhost i get the drupal site

a - i whant that druapl will be in his folder localhost/drupal/ ....
b- now localhost/phpmyadmin redirect to error page of drupal site


thank you

Deny host to 403 Page with PHP (no replies)

$
0
0
Hello all,

I've setup a webserver with NGINX and PHP-FPM.
Everything is working correctly except for this.

I have a list of IP's that I block.
I want the 'bad hosts' (blocked IP's) to be redirected to a 403 page.

Unfortunately the PHP on the page doesn't get executed.
(Its supposed to echo back the IP address where the user is connecting from).

Any idea on how I can fix this?

Thanks!

Nginx server running but not work. [+Magento, varnish and nginx] (no replies)

$
0
0
Hi, i have a problem, in my link server i'nst work
http://50.116.109.106:8086/
(yeah i have a change port 2 times, first to 8080 now to 8086, the website with magento store dont appears, dont work. i no have idea do to do for solution
nginx version: nginx/1.6.0
magento version 1.9.0.1
The server is configured for: Varnish run in port 80, magento with nginx 8086, with nginx page_speed (ngx_pagespeed-1.8.31.4-beta), but i dont have a succes with this,

NGINX.CONF

user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
types_hash_bucket_size 64;
server_names_hash_bucket_size 128;
#access_log logs/access.log main;

log_format varnish_log '$http_x_forwarded_for - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent "$http_referer" ' '"$http_user_agent"' ;

pagespeed on;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/ngx_pagespeed_cache;

sendfile on;
autoindex off;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}

keepalive_timeout 65;

gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*;
include /etc/nginx/sites-enabled/*;

map $scheme $fastcgi_https {
defaulf off;
https on;
}


}
====================================
AND (DEFAULT_HOST.conf)

server {
listen *:8086 default_server;
server_name 50.116.109.106:8086;

error_log /var/log/nginx/site-error.log warn;
access_log /var/log/nginx/site-access.log;
include ngx_pagespeed;
#include=/etc/php-fpm.d/*.conf

pagespeed on;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/ngx_pagespeed_cache;

location / {
root /home/popipe/public_html/;
index index.html index.php;
}

# Ensure requests for pagespeed optimized resources go to the pagespeed
# handler and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
location /pagespeed_console { allow 127.0.0.1; deny all; }

pagespeed DisableRewriteOnNoTransform off;
pagespeed ModifyCachingHeaders off;
pagespeed EnableFilters rewrite_images;
pagespeed EnableFilters recompress_images;
pagespeed EnableFilters convert_jpeg_to_progressive;
pagespeed EnableFilters recompress_jpeg;
pagespeed EnableFilters recompress_png;
pagespeed EnableFilters recompress_webp;
pagespeed EnableFilters strip_image_meta_data;
pagespeed EnableFilters jpeg_subsampling;
pagespeed EnableFilters resize_images;
pagespeed ProgressiveJpegMinBytes min_bytes;

# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
#end configuration for pagespeed optimized images

location / {
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
}

## These locations would be hidden by .htaccess normally
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }

location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}

location /. { ## Disable .htaccess and other hidden files
return 404;
}

location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}

location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
# Pass PHP scripts to PHP-FPM
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9001;
fastcgi_param SCRIPT_FILENAME $/etc/nginx/$fastcgi_script_name;
include /etc/nginx/fastcgi_params;

fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
}

rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;

location /lib/minify/ {
allow all;
}
gzip on;
#gzip_comp_level 9;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain application/xml text/css text/js application/x-javascript;

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
}
==========================================================
My firewall in server already opened this port 8080 and 8086 and 80, but solution is not work

I wait for help, please
thanks for all

problem with limit_conn (no replies)

$
0
0
hi guys ,
I am using nginx version 1.0.10 on linux centos 6.5 . I want to add the following to lines to my nginx config file:
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:20m;
limit_conn conn_limit_per_ip 3;

But after that when I try to restart nginx I get the following error :
Starting nginx: nginx: [emerg] unknown directive "limit_conn_zone" in /etc/nginx/nginx.conf:31
[FAILED]

what should I do to solve this ?
thank you

Convert from port to path (no replies)

$
0
0
Looking to convert this working conf

server {
server_name zoneminder-webgui;
root /usr/share/zoneminder;
index index.php;
autoindex off;
server_tokens off;
sendfile on;
large_client_header_buffers 4 32k;
error_log /var/log/nginx/zoneminder-webgui_error.log error;
access_log /var/log/nginx/zoneminder-webgui_access.log combined;

location /images/ {
alias /usr/share/zoneminder/images/;
}

location /cgi-bin/ {
proxy_pass http://127.0.0.1:4085;
}

location ~ \.php$ {
root /usr/share/zoneminder;
fastcgi_pass unix:/var/run/php5-fpm-zoneminder-webgui.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/zoneminder/$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /usr/share/zoneminder;
}

listen [::]:81 default_server ipv6only=off;
}

to something like this

location /zm/ {
alias /usr/share/zoneminder/;
index index.php;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm-zoneminder-webgui.sock;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /usr/share/zoneminder/$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;
include fastcgi_params;
}

location /zm/images/ {
root /var/cache/zoneminder/images/;
}

location /zm/cgi-bin/ {
proxy_pass http://127.0.0.1:4085;
}


location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
}

This does show the site but does not look to run the files in /zm/cgi-bin/

Thanks for looking.
Miller

Auth - How To Shut Off (no replies)

$
0
0
Hello, I previously set up auth on most of my wordpress websites (all on separate vhost files). It worked successfully but once I removed the following from each vhost I am still getting prompted to enter a username and password. Anyone have a clue on why this is happening?

#Password Protect The WordPress Admin Folder
location ^~ /wp-admin{
auth_basic "Restricted Access";
auth_basic_user_file /usr/local/nginx/.htpasswd;
}

Single point login (no replies)

$
0
0
Don't know what to call this, but single sign on seems to be close, but i'll break it down.

Can nginx provide me with a solution to allow people to access a variety of services on a server, on a single port?

For example,

plex is on 36400
deluge is on 8117
http is on 80 and 8080

the first two are restricted to allow access to local network clients only, and plex goes even further by allowing full access to anyone on the local network. What i'm trying to do is provide a login point on a single port that can then access all the other services. This allows me to connect to the services via remote locations and still provide security in the form of a login.

Only other solution i've come across is a socks proxy, which does the trick, but i have some other ideas i want to implement which i think nginx will be able to help with. the main one is, the first page after login would offer a set of links to all the individual services, meaning i don't have to remember every port.

I reckon in terms of security, this might be better too, as i only have to manage security for one application (nginx) and can limit what ip's can access it. the firewall would reject every other port other than nginx's.

I hope this makes sense.

nginx reverse proxy problem (no replies)

$
0
0
Hello everyone,

i wanted to mirroring my other site using nginx
but what i get is only apache page
is there something i need to do ?

info :
both domain in different ip
target site using cpanel apache

thank you

"map $url" does not work instead of "if $url" (no replies)

$
0
0
This configuration works:

if ($uri ~ "/(apple|banana|orange)/") {
set $nocache 1;
}

However this does not work:

map $uri $nocache {
default 0;
~^/(apple|banana|orange)/ 1;
}

I prefer using map for performance reasons, furthermore "if is evil". Would you point me to the right direction to improve the map statement?

Problem setting up rewrite rules (no replies)

$
0
0
Hello guys,

The problem is with the rewrite rules: I'm not sure if I need to include something in order to get the rewrite module included in nginx. Any idea or help will be appreciated! Before writing I tried looking into the forum to see if someone was having the same problem but I seems that it does not.

here is my nginx's configuration file:

server {
listen 80 default_server;
server_name example.com;

rewrite ^(.*)$ index.php?url=$1 last;
rewrite testing index.php last;

root /home/victor/Documents/web/example.com;
error_log /home/victor/Documents/web/logs/example.log;
index index.php;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}

When I try in the browser with http://example.com it works.
When I try in the browser with http://example.com/something it does NOT work.
When I try in the browser with http://example.com/testing it does NOT work too.

This is the ouput of the log file:

2014/08/07 14:55:30 [error] 5700#0: *1 open() "/home/victor/Documents/web/example.com/something" failed (2: No such file or directory), client: 127.0.0.1, server: example.com, request: "GET /something HTTP/1.1", host: "example.com"

2014/08/07 15:47:29 [error] 5996#0: *1 open() "/home/victor/Documents/web/example.com/testing" failed (2: No such file or directory), client: 127.0.0.1, server: example.com, request: "GET /testing HTTP/1.1", host: "example.com"

Thanks in advance!

Cannot resolve error 304 in my magento Shop (no replies)

$
0
0
Hello,

I recently switched from Apache to NGINX. So far I like this Server. Pretty fast and easy to config. Now I am experiencing problems using a Magento Shop running on NGINX. Installation works fine but when it comes to working in the backend I am having dozens of 304 erros not showing images, js and css which makes the backend unusable.

I am running NGINX on a preconfigured PLESK and added following directives:

if_modified_since off;
proxy_set_header If-None-Match "";
add_header Last-Modified "";

to webserver settings for my domain. I also tried to add these directives to the nginx.conf.

Neither works for me. The browsers (Firefox, Chrome) will always return 304 errors. Sometimes I see some more images and tables when I refresh the pages or empty the cache. I also emptied the browser caches several times.

I am working on this problem for days now and I cannot figure out a solution.

I really tried my best googling and reading articles but all did not work.

Can anybody point me in the right direction?

Thanks

Danska
Viewing all 2931 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>