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

Does ngx_http_rewrite_module is auto added with source compilation ? (1 reply)

$
0
0
Hello,

I followed an excellent tutorial on how to compile nginx with ngx_pagespeed @ http://www.howtoforge.com/using-ngx_pagespeed-with-nginx-on-debian-jessie-testing

I wanted to know if ngx_http_rewrite_module is auto added with source compilation ?
If not, do I have to add it like --with-ngx_http_rewrite_module or any other instruction while editing rules file ?

Because URLs are not rewriten on my prestashop domain.

Here is my domain conf file :

pagespeed MemcachedThreads 1;
pagespeed MemcachedServers "localhost:11211";

pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters collapse_whitespace,remove_comments;

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_global_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; }

# REWRITE

rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
try_files $uri $uri/ /index.php$is_args$args;
error_page 404 /index.php?controller=404;


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

# PHP

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
include fastcgi_params;
fastcgi_read_timeout 600;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}

Thanks in advance for help !

Using cache on Windows x64 (1 reply)

$
0
0
What is preventing Nginx from using cache and shared memory on windows x64 with disabled Address Space Layout Randomization

On newer windows x64 Address Space Layout Randomization (ASLR) can be disabled using this utility:
http://www.microsoft.com/en-us/download/details.aspx?id=29851

However after disabling ASLR Nginx still refuses to use shared memory functions and cache. Is there a way to make Nginx to be fully functional on Windows x64.?

No input file specified. (1 reply)

$
0
0
yet another "No input file specified." topic(

I can't figure it out on my own, so someone give me a hand please)

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME $request_filename;

permissions are ok

root@test:~ # su -m www
www@test:~ % file /usr/local/www/nginx/php/phpinfo.php
/usr/local/www/nginx/php/phpinfo.php: PHP script, ASCII text
www@test:~ % exit
root@test:~ #

root@test:~ # curl localhost/php/phpinfo.php
No input file specified.
root@test:~ # curl localhost/php/phpinfo.php -I
HTTP/1.1 404 Not Found
Server: nginx/1.4.4
Date: Mon, 17 Feb 2014 05:01:24 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.4.25

root@test:~ #

WebDAV COPY and MOVE problem (no replies)

$
0
0
Hello,

I configure NGINX to be a WebDAV server:

server {
listen 8283;
server_name 127.0.0.1;

root /home;

charset utf-8;
create_full_put_path on;
client_max_body_size 4g;
client_body_timeout 600s;
client_body_buffer_size 512k;
# for we can mv uploaded files in the same partition
client_body_temp_path /home/_tmp_/nginx 1 2;

dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;

location / {
deny all;
}

location ~ ^/users/(\w+)(/.*)?$ {
alias /home/$1$2;
auth_basic "emNAS";
auth_basic_user_file /opt/emnas/etc/webdav/$1.ht;
autoindex on;
}
}

I tested COPY and MOVE not work. Track the code with GDB, the problem
is in function ngx_http_dav_copy_move_handler() which calls ngx_http_map_uri_to_path()
to map destination URI to destination path. But it map destination URI to source path.
So the MOVE does nothing, the COPY report file exists error.

For example,
MOVE http://localhost:8283/users/admin/aaa to http://localhost:8283/users/admin/bbb
results an FS op
RENAME /home/admin/aaa to /home/admin/aaa
which does nothing.

The wrong path from correct URI is generated by ngx_http_script_run() which execute
some code from configuration.
I'm not familiar with NGINX, so I don't know where is the cause of this problem.
Is it an NGINX bug or my wrong configuration?

I tested NGINX 1.1.19, 1.2.1, 1.4.5, 1.5.10. They all have the problem.

Regards,
Qiang

Super noob question about setting up round robin fan out and also some other questions (no replies)

$
0
0
So I want a setup where the user has a primary access (site1) and from there, if they click an icon, they are routed somewhere else (Which is actually roundrobin'd between 2 sites, sites3/4).
so SITE1 is:
upstream backend1 {
server ip:<SITE2>;
}
server {
server_name localhost;

listen <SITE1>;

root /srv/dev_site1/www;

access_log /var/log/nginx/access_dev_site1.log;

error_log /var/log/nginx/error_dev_site1.log;

location / {

add_header a b;

}

location = /site1/{

proxy_pass http://backend1;

}
}
SITE2 is:
upstream backend {
server ip:<SITE3>;
server ip:<SITE4>;
}
server {
server_name localhost;

listen <SITE2>;

root /srv/dev_site2/www;

access_log /var/log/nginx/access_dev_site2.log;

error_log /var/log/nginx/error_dev_site2.log;



location /{

proxy_pass http://backend;



}
where SITE3 and SITE4 are identical in data.
I feel like something is redundant in the above. In addition, I want to make it somehow such that if in site 1 I have a location where its /siteX/, where it gets routed to can have the url stripped of the /siteX/, and the url contains only the base site + the URI hope this is clear..
thanks for any input.

FastCGI setup error (no replies)

$
0
0
I’m getting the following error when attempting to add the 3 fastcgi_cache lines below to the mysite.com config file:

root@server:/etc/nginx/sites-available# nginx -t && service nginx reload
nginx: [emerg] the size 104857600 of shared memory zone “WORDPRESS” conflicts with already declared size 51380224 in /etc/nginx/sites-enabled/mysite.com:4
nginx: configuration file /etc/nginx/nginx.conf test failed

fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;

noob question about ssl (no replies)

$
0
0
I'm using nginx as a reverse-proxy front-end for an ajax web app. This web app has lots of sections accessible to the general public, plus it has "member" areas where they have to be logged in. I use SSL for the members, letting nginx handle the encryption and always connecting to the web app unencrypted. But, switching from a non-ssl connection to one that is encrypted means the web app has to reload, which takes time (well, in order for me to switch to ssl mode, I have to direct the visitor to the https version of the URL, which in effect loads a new session).

Is there a way to instruct nginx switch to an encrypted connection without forcing a URL reload? I don't want to redirect all connections to always use ssl, as this is a large app/site and it would put too much load on the server.

Thanks,
Jay

How to Test ngx_http_limit_req_module (1 reply)

$
0
0
Hello,

I've recently installed nginx 1.4.5 on a Pogoplug (ARMv5) running Arch Linux ARM.

I reviewed the nginx package build file and notice that "--without-http_limit_req_module" was not specified in the build configuration. Given that (according to the information on http://wiki.nginx.org/Modules), ngx_http_limit_req_module should be in the build I've installed.

However, I cannot seem to see this module in action. I've added the following to my nginx.conf file:

http {
limit_req_zone $binary_remote_addr zone=one:1m rate=10r/m;
limit_req_log_level info;
limit_req_status 503;
# I assumed these settings would let me test the module quickly and easily.
# etc., etc.

After updating the nginx.conf, I restarted nginx. Then I began "testing."

My test consisted of me entering my.site.com (using my actual site name) into my browser. When my index.html page came up, I hit refresh about 20 times in rapid succession. :)

Unfortunately, my index page was served up 20 times, as well.

I would have expected that ngx_http_limit_req_module, and the configuration (listed above), would have caused nginx to throw a 503 pretty quickly, but it never did.

Am I testing this incorrectly?

Or have I missed something in the configuration of ngx_http_limit_req_module?

Or what?

Thanks for your help with this,

steady
------------------------------------------------------------------------------------------
Here's the full build configuration for those curious:

build() {
cd $pkgname-$pkgver
./configure \
--prefix=/etc/nginx \
--conf-path=/etc/nginx/nginx.conf \
--sbin-path=/usr/bin/nginx \
--pid-path=/run/nginx.pid \
--lock-path=/run/lock/nginx.lock \
--user=http \
--group=http \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=stderr \
--http-client-body-temp-path=/var/lib/nginx/client-body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-imap \
--with-imap_ssl_module \
--with-ipv6 \
--with-pcre-jit \
--with-file-aio \
--with-http_dav_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_spdy_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_addition_module \
--with-http_degradation_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_secure_link_module \
--with-http_sub_module

I still have errors like 502 Bad Gateway and upstream problems :/ (1 reply)

$
0
0
Hello

On a server driven by NGINX with PHP-FPM I'm trying to eliminate errors like
- 502 Bad Gateway
- recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xx.xx.xx.xx, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9017", host: "example.com"
- connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9017", host: "example.com"

I have tried many configuration changes.
- added buffers
- stop using sockets (for Bad Gateway)...

I still have those errors and it's driving me crazy.
Here are my conf files :

Here is my /etc/nginx/nginx.conf

================================================================
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
worker_connections 2048;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 100;
client_max_body_size 10m;
client_header_timeout 1460;
client_body_timeout 1460;
types_hash_max_size 2048;
server_tokens off;
index index.php index.htm index.html redirect.php;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_types text/plain text/css application/json application/x-javascript text/xml
application/xml application/xml+rss text/javascript;

#FastCGI
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_index index.php;

#microcache
fastcgi_cache_path /var/cache/nginx2 levels=1:2 keys_zone=microcache:5m max_size=1000m;
log_format cache '$remote_addr - $remote_user [$time_local] "$request" '
'$status $upstream_cache_status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

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

Here is my /etc/nginx/sites-available/example.com.vhost

================================================================
server {
listen *:80;
server_name example.com ;
root /var/www/example.com/web;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
..........
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9017;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
..........
================================================================

Here is my /etc/php5/fpm/pool.d/xxxxxx.conf relative to example.com
================================================================
[web8]

listen = 127.0.0.1:9017
listen.allowed_clients = 127.0.0.1

user = web8
group = client1

pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 0
...............
================================================================


Please, do you see parameters that are wrong ?

Thank you by advance

Mailserver (no replies)

$
0
0
Hi, I builded a webside with nginx mariadb shopware and now i want to add a mail server so my shopware can send mails.this is only a test server so it is not online. i use Ubuntu 12.04 LTS as a VM. i installed nginx with apt-get install not with ./configure. now the problem is i cant use the mailserver and i dont know how to add it. i am pretty new to that stuff so i dont understand everything yet some help would be nice.

Thanks

EDIT: everything else is working, shopware does not have any errors, only that i cant send any mails.

solve "maximum number of descriptors" problem (1 reply)

$
0
0
we're using nginx under windows 2012 server, package WT-NMP.
load is getting higher and today we're started getting this errors in error log

2014/02/20 16:21:29 [error] 4744#712: *94523 maximum number of descriptors supported by select() is 1024 while connecting to upstream, client: 82.145.222.30, server: someserver.ru, request: "GET /feed/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9163", host: "www.someserver.ru"

most of clients are getting pages normally, but some (I think 5%) get error 500 or "can't connect"

we've worker_processes 2 (increasing doesn't help)
worker_connections 16384;

we've phpfarm with 160 processes
upstream php_farm {
server 127.0.0.1:9001 weight=1 max_fails=3 fail_timeout=15s;
server 127.0.0.1:9002 weight=1 max_fails=3 fail_timeout=15s;
server 127.0.0.1:9003 weight=1 max_fails=3 fail_timeout=15s;
...

I've searched the web and some people say you can change file handle limit in config.nt, I've tried to put
files=4096
in c:\windows\system32\config.nt
but nothing changed.

please help to solve this error, so all our clients can get pages.

Problems with Geo-Switch (no replies)

$
0
0
Hi,

I'am very new to nginx and I have to realize a location switch. We have a single point of entry https://switching.beta.tecdi/DMS/. At this single point of entry I have to split up the requests depending on the location of the ip of the client, namely based on the following rules:

Pass requests of users from location X to https://dms-autom.server.tecdi:8444/DMS/
Pass requests of users from location Y to https://alm-staging-vm.entertain.tecdi:10090/svnwebclient.webapp/

I attached 2 configurations. The first configuration is a very simple configuration without variables. This configuration doesn't work because it seams, that the request isn't correctly rewritten. Especially, when I navigate to some sites, I get redirected to the backend "http://boehm.dresden.tgr.local:9080" and not the single point of entry. I played around with variable $request_uri, but I'm not sure wether I use it in the right way.

The second more complex configuration has the location switch. There I also have some sites, where the redirect is wrong. Can somebody describe, if I use the directives correct or have I missunderstood the nginx-documention?

Is the usage of directives rewrite, proxy_pass and proxy_redirect correct or have I missed something or missused something? Especially I doesn't found any proper description in which cases and in which directives I can use variables or regex-replacements for path, port, schema and resourcepath .

Thanks for your reply

Show the effective values of variables (no replies)

$
0
0
How do I show the effective value of variables of nginx configuration at runtime? Or is there an alternative way to print the variable values for debuggin purposes?

trying to set nginx wp-multisite keep getting 500 Internal Server Error (no replies)

$
0
0
I am following https://rtcamp.com/wordpress-nginx/tutorials/multisite/subdomains/minimal/ to try and set up nginx - wp-multi site.

I keep getting 500 internal server error

Dont know why.

The following is my config files:

nginx.conf file:
----------------------------------------------------------
user www-data;
worker_processes 2;
pid /run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml applicatio$
include /etc/nginx/sites-enabled/*;
}
----------------------------------------------------------

This is my server specific file inside site-enabled:
----------------------------------------------------------
server {
server_name mygametests.info *.mygametests.info ;
access_log /var/log/nginx/mygametests.info.access.log;
error_log /var/log/nginx/mygametests.info.error.log;

root /usr/share/nginx/html/mygametests/htdocs;
index index.php;

location / {
try_files $uri $uri/ /index.php?$args ;
}

location ~ \.php$ {
try_files $uri /index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}

location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}

location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
}

----------------------------------------------------------
My errors log files:

file: mygametests.info.error.log

`2014/02/21 03:10:54 [error] 3191#0: *1 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: xxx.xxx.xxx.xxx, server: mygametests.info, request: "GET /wp-admin$`

file: mygametests.info.access.log

`xxx.xxx.xxx.xxx - - [21/Feb/2014:03:10:54 +0000] "GET /wp-admin HTTP/1.1" 500 201 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"`

I know this is a long question have been at this for long time now any help would be highly appreciated

Help with "unknown directive" (no replies)

$
0
0
Hi, i'm Claudio,
i have some problem with nginx on a raspberry pi, i have installed the version 1.4.5,
after installation, had lunched and it works good, but now when i modify the nginx.conf in /etc/nginx have ever th problem with an "unknown directive"

here is mine nginx.conf
https://gist.github.com/traverso85/9156732

where i do wrong? someone can help me?

Thanks Claudio

Codeigniter Configuration - 404 Page Not Found Error (no replies)

$
0
0
I am not sure how many times this question has been answered before, but every answer that I look at gives a different approach to solving this problem of which none of them worked. I am migrating from Apache to Nginx and am facing some serious problems with setting it up. My /etc/nginx/sites-available/default looks like this...

# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep thi;s around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6

root /usr/share/nginx/www/flo2go/;
index index.php index.html index.htm;
if ($request_filename !~ (js|css|images|robots\.txt|index\.php.*) ) {
rewrite ^/(.*)$ /index.php/$1 last;
}

# Make site accessible from http://localhost/
server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html

try_files $uri $uri/ /index.php;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ /index.php/
{
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/flo2go/index.php;
fastcgi_param REQUEST_URI $request_uri;
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_pass unix:/var/run/php5-fpm.sock;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}

# Only for nginx-naxsi : process denied requests
#location /RequestDenied {
# For example, return an error code
#return 418;
#}

#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 /usr/share/nginx/www;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}

I have tried everything to make my web application work. All I keep getting is the 404:Page Not Found error. The site was working perfectly on Apache and after spending almost 3-4 hours in solving this problem I thought that it would be better to seek the advise of experts on this forum. Hope somebody can bail me out of this situation :(

Change Port (2 replies)

$
0
0
Hey you,

I try to switch from apache2 to NGINX.

I edited all configs of NGINX so, that the Port listens on "1337" but NGINX is alway saying:

[...]
nginx: [warn] conflicting server name "meinedomain.de" on 123.456.789.123:1337, ignored
nginx: [warn] conflicting server name "meinedomain2.de" on 123.456.789.123:1337, ignored
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.


But I cant find any entry for "80" at nginx' configs.

Are you able to help me? :)

Monitoring nginx active connexions (no replies)

$
0
0
Helly guys,

I was using nginx_status to monitor my nginx. My company decided to install a firewall in front of my nginx :( and now my stats are all wrongs. Before I had Active connections: 3000 and now I have Active connections: 11.

Do you have any other free solution to have the same information to monitor my nginx connexions?

Thanks

Changed Root Path, PHP not working any more (no replies)

$
0
0
Hello, I'm new to nginx so i'm sure i'm missing something basic...

I installed php and nginx on debian wheezy (virtualbox machine). Everything worked fine when I left the default root path at /usr/share/nginx/www. As soon as I change it to /var/www, php doesn't work any more (tags & commands are output to html text instead of interpreted).

Could there be some php setting i've missed?


This works:

server {
listen 80;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name localhost;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
##fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}




This doesn't:

server {
listen 80;
listen [::]:80 default_server ipv6only=on;

root /var/www;

index index.php index.html index.htm;

server_name localhost;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
##fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}

gzip cause white screen of death (wsod) (no replies)

$
0
0
Hi Guys, I have a problem here. My website, www.tokopedia.com use nginx 1.5.10 with gzip activated. Some of our users got white screen of death (wsod). It turns out that it is because of gzip. These are what I found :

User report the got wsod. I chat with them, asked them to response header. But the header is different from what we set. This is the result :

This is the corrent response header :
========================
Cache-control:max-age=14400
Connection:close
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Mon, 24 Feb 2014 15:06:20 GMT
Expires:Mon, 24 Feb 2014 19:06:52 GMT
Pragma:no-cache
Server:nginx
Set-Cookie:_SID_Tokopedia_=c52cd95c9d4b11e3b16d11f55476c0ce; domain=.tokopedia.com; path=/; expires=Tue, 25-Feb-2014 15:06:52 GMT
Vary:Accept-Encoding

This is user response header
========================
Cache-control: private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Type:text/html; charset=utf-8
Date:Mon, 24 Feb 2014 05:40:31 GMT
Expires:Mon, 17 Aug 2009 00:00:00 GMT
Pragma:no-cache
Server:nginx
Set-Cookie:_SID_Tokopedia_=70531bd49d1511e3adeb5c5c41ecde91; domain=.tokopedia.com; path=/; expires=Mon, 24-Feb-2014 06:41:02 GMT
Transfer-Encoding:chunked
Vary:Accept-Encoding

the different is that the correct 1 has Content-Encoding:gzip and no Transfer-Encoding:chunked. But on user side they have Transfer-Encoding:chunked but no Content-Encoding:gzip.

And then I tried to disabled gzip and then user can access our website without problems.

So can you guys help me with solutions? I think about to put this of nginx conf :

if($remote_addr = 'xxx') {gzip off;}

but the problem is on user specific device, if they use other device with the same internet connection, they can access without problem.
Viewing all 2931 articles
Browse latest View live


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