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

accessing two different sites by 192.x.x.x/test1 and 192.x.x.x/test2 possible? (1 reply)

$
0
0
Hey there,

I spent couple of days to get this running, but did not succeed:

On my raspberry I want to run owncloud and web-service to manage mpd. I set up the owncloud and also the mentioned webservice.

As I am not sure, if this really possible, here is my kind of wish-list:

I would like to access owncloud in my local network by typing 192,x.x.x/cloud to get to the owncloud start page.
With 192.x.x.x/music I would like to get the site of the music-service.

As I spent several days to get this running without success, I would like to ask, if this realisation is possible or not. If it is possible I will decribe my actual set-up of nginx and fpm-php much clearer.

Thanks,
Matthias

Isolating a specific server performance (no replies)

$
0
0
Welcome

I'm using nginx as a reverse proxy for different types of backends, which serve dozens of websites. I would like to limit individual websites on the proxy. For example, one website has allocated about 25% of server capacity, the second about 15%, while other websites share the remaining capacity (about 60%). Ultimately, it is to be possible to isolate specific server performance (for several major websites) that will always be available regardless of the load of other websites.

Thank you for the advice.

Maximum connections per worker? (no replies)

$
0
0
Hello

In general i am setting on 8 core and 8 threads total 16 only four nginx workers so i let the rest for php-fpm and mysql ...

But how many connections i must set as maximum per worker?

How many 1 worker can handle on a very busy forum?

Thank you

HHVM and nginx (no replies)

$
0
0
In general i think php-fpm is not very efficient and i am wondering if anyone test the new facebook HHVM instead and how it goes?

Other competitors has worst web server than nginx but better php handlers....

Thank you

auth php error (no replies)

$
0
0
Hello,

I have a centos 6 server where I would like to have basic authentication of a directory containing a wordpress blog.
my virtual.conf looks like this:

server {
listen 80;
# listen *:80;
server_name myserver.com www.myserver.com;

location / {
root /usr/share/nginx/html/myserver;
index index.html index.htm index.php;
}


location ~ \.php$ {
root /usr/share/nginx/html/myserver;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


location /members {
auth_basic "Basic Auth";
auth_basic_user_file "/usr/share/nginx/html/myserver/Zombaio_Data/.htpasswd";
location ~ \.php$ {
#root /usr/share/nginx/html/myserver/members;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

}


}


when I open the /members It asks for the password and accepts is, but does not open the index.php it sais 404 error

can i catch upstream output and display something else? (no replies)

$
0
0
I have a dumb custom webserver behind nginx (that i am stuck with), that will occasionally go into a maintenance mode, where it is not able to serve its' normal content, but instead just sends "File not found" message in response body with HTTP code 200.

Unfortunately at the moment there is nothing I can do to make the upstream webserver to behave and send a 503, which I could then handle. Is there any way I can match against such upstream output to redirect it to a 503 page served by nginx?

How to add modules to nginx wiki ? (no replies)

$
0
0
Hi :
I want to submit my modules to nginx as a third party module. How to make it ? I googled and someone suggested to just edit the wiki . I tried to create an account of wiki but failed , nginx sent me an email to confirm the register, but I can not login after confirmed , why? I needs your help , thank you in advance ~

Best practice question (no replies)

$
0
0
Hi,

I just wanted to learn what is the best practice or solution on how multiple owners of sites powered by nginx could add their redirects?

I know that in Apache this can be done with per user .htaccess but as nginx doesn't have such feature i'm eager to know how this is usually done in multi-site environment with nginx.

I would have couple of wordpress blogs hosted on one server and couple of users to maintain them. Ideally, each one of them should be able to add redirections at least.

Would it be possible for nginx somehow to use per user vhost configs included in nginx.conf and apply them somehow in runtime?

500 Internal Server Error - Welcome to nginx! (no replies)

$
0
0
Hello , I installed ispconfig on my vps and I uploaded the wordpress files ftp , when trying to access my domain, I get error: '500 Internal Server Error ', well no www or without www redirects .. These are my files :

/ etc / nginx / sites -available / domain

server {
listen * : 80 ;
root / var / www / domain.com / web ;

server_name domain.com www.domain.com ;
index index.php index.html index.html ;

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

error_page 400 / error/404.html ;
error_page 500 502 504 / 50x.html ;
recursive_error_pages on ;

error_log / var / log / ispconfig / httpd / domain.com / error.log ;
access_log / var / log / ispconfig / httpd / domain.com / access.log combined ;


location / stats / {

index index.php index.html ;
auth_basic "Members Only " ;
auth_basic_user_file / var/www/clients/client0/web3/web/stats / htpasswd_stats . ;
}

location ^ ~ / awstats -icon {
alias / usr / share / awstats / icon ;
}

location ~ \ . php $ {
try_files / f7353ed3642bbbc08e4209a6028762cd.htm @ php ;
}

location @ php {
try_files $ uri = 404;
include / etc / nginx / fastcgi_params ;
fastcgi_pass unix :/ var/lib/php5-fpm/web3.sock ;
fastcgi_index index.php ;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name ;
fastcgi_intercept_errors on ;
}

}


Can someone help me please? I offer $ 10 reward to whom help me solve this issue.

Thanks.

Unexpected SSL Behavior with Virtual Hosts (no replies)

$
0
0
I'm using nginx to provide service for 4 virtual hosts on the same physical server. The issue I'm having is that a browser request for https://www.domain1.org/ is being answered with a certificate for a different domain. Here's what the slices from my config files look like:

domain1.conf: (note that there's no listen directive for port 443)
server {
listen 80;
server_name domain1.org www.domain1.org domain1.com www.domain1.com domain1.net www.domain1.net domain1.us www.domain1.us domain1.info www.domain1.info;
root /home/domain1/public_html;

# more stuff
}

domain2.conf:
server {
listen 80;

server_name domain2 www.domain2;
root /home/domain2/public_html;

# more stuff
}

server { ## SSL config for domain2
listen 443 ssl;

ssl_certificate /etc/ssl/certs/domain2-chained.crt;
ssl_certificate_key /etc/ssl/private/domain2.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;

server_name domain2 www.domain2;
root /home/domain2/public_html;

# more stuff
}

server {
listen 80;

server_name domain3 www.domain3;
root /var/www;

access_log /var/log/nginx/access-domain3.log;
error_log /var/log/nginx/error-domain3.log;

return 301 https://$host$request_uri;
}

server { ## SSL config for domain3
listen 443 ssl;

ssl_certificate /etc/ssl/certs/domain3-chained.crt;
ssl_certificate_key /etc/ssl/private/server.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;

root /var/www;
index index.php index.html index.htm;

access_log /var/log/nginx/access-domain3-ssl.log;
error_log /var/log/nginx/error-domain3-ssl.log;
rewrite_log on;

server_name www.domain3 domain3;

# more stuff
}

A browser request for https://www.domain1.org/ returns the certificate for domain 2 and the content found in the root for domain2. Why is that and how can I get the server to redirect to http://www.domain1.org/ instead?

First time download is slow (no replies)

$
0
0
hello,
i have a dedicated server, Debian distro, Apache the website is based on a prestashop ecommerce script, recently i added Nginx as a reverse proxy and set up a basic configuration. It works ok, i reduced TTFB from 5 to 2 seconds on average, but the first time i access my website (whenever i open my browser and type the url), it has a TTFB (time to first byte) of 6 to 10 seconds ! but subsequent page loads are ok average TTFB of 2 seconds.

Is it normal?
thank you for any help

try_files and static content with query string (token/version) (no replies)

$
0
0
Hi all.

I'm adding an nginx in front of an Apache webserver. The idea is to serve static content with nginx and dynamic content with Apache. I've moved Apache to port 8080 and created the following nginx configuration:

# ... = snip of extensions for readability purposes
location ~* \.(jpg|jpeg|gif|png|ico|css|...|js|htm|html)$ {
try_files $request_uri @apache;
}

location @apache {
include /etc/nginx/proxy.conf;
proxy_pass http://127.0.0.1:8080;
}

This works well with files like:

/modules/contextual/images/gear-select.png
/sites/all/themes/unm/images/twitter.png
/sites/all/themes/unm/images/icon-bg.png
/sites/all/themes/unm/favicon.ico

Those files are served from nginx and they never touch Apache.

My problem is with files like:

/sites/default/files/styles/medium/public/field/image/20130720.jpg?itok=u2KK3COA
/sites/all/libraries/superfish/css/superfish.css?n5i2r9

That's it: files with a token or version string in the query string (used to improve caching with expires max and allow correct image update in the browser by changing the token).

For those files, I need to "strip" the query string for the try_files, and match:

/sites/default/files/styles/medium/public/field/image/20130720.jpg?itok=u2KK3COA
---> strip query string
---> /sites/default/files/styles/medium/public/field/image/20130720.jpg (file exists)

/sites/all/libraries/superfish/css/superfish.css?n5i2r9
---> strip query string
----> /sites/all/libraries/superfish/css/superfish.css (file exists)

I first tested the following:

location ~* ^(.*\.)(jpg|jpeg|gif|png|ico|css|...|js|htm|html)(\?.*)$ {
try_files "$1$2" @apache;
}

But it didn't work. Those files continued reaching apache.

Then I read that location regexp matching doesn't include the query string, so I don't know how to "match" the "uri/filename.ext?string" pattern and how to test it against the filename without the query string.

I also tried:

# ... = snip of extensions for readability purposes
location ~* \.(jpg|jpeg|gif|png|ico|css|...|js|htm|html) {
try_files $request_uri $uri @apache;
}

(removing the $ at the end of the regexp matches everything, both file.png and file.png?version)

I thought that this will try first file.png?version on disk, then file.png and then a fallback to apache, but when I try that, the site is sloooooow, takes ages to load (timeouts? I don't know why).

So ... what I'm doing wrong? How do I "try_files" my static files with token? Must I use if() with something like:

location ~* ^(.*\.)(jpg|jpeg|gif|png|ico|css|...|js|htm|html) {

if ($is_args) {
# do something
# but ... if was supossed to break the next try_files!!! :?
}
try_files $request_uri @apache;
}

Thanks for any help.

Magento Wordpress Nginx Configuration (no replies)

$
0
0
I have a Magento shop at http://example.com and I want to keep a Wordpress blog at http://example.com/blog. I have installed the blog and everything seems to be fine but when am logging to Wp-Admin am getting 404 for css and js files .

Flash Policy Server Troubles (no replies)

$
0
0
Hello, I am attempting to get a flash policy server (sorta) working via nginx. Various sites cover a work-around to make nginx serve the policy file via the 400 error with some redirect magic, however I cannot seem to get this to work for me properly and the result being the flash control refuses to load the policy from the server.

To start, the server is sub-domained and each domain has its own config for nginx.
The focused subdomain for this is: irc1.ffevo.net

The configuration file is currently as follows:
http://www.privatepaste.com/57f75dbf35

This works to make the policy show up in the 400 error but my flash object refuses to load saying it cannot load the policy at the given location.
This did work not too long ago on my server but all of a sudden it has stopped and I am clueless as to what is causing it to no longer work.

Setting Up Nginx + PHP-FPM to handle 1000 Connections !simultaneously! (no replies)

$
0
0
Hello,

I'm trying to setting up nginx + php-fpm to handle many connections simultaneously but i can't.
My Current Config of nginx.conf is the following

user www-data;
worker_processes 8;
worker_rlimit_nofile 150000;
pid /run/nginx.pid;
events {
worker_connections 150000;
multi_accept on;
use epoll;
}


http {
.......
}


My php pool config is the following:

pm = ondemand
pm.max_children = 4000


I tried to set pm as static/dynamic but nothing of them worked properly. Even if i setted that to: ondemand and max_children 4000 always nginx crashes at ~400 Open connections.

I always get something like 400-430 Connections and it can't handle more. I get Bad Gateway error after that and the connections are being closed.

Thank you
Hope you understand

Tricky Nginx Caching Case - Download Server - Huge Traffic (no replies)

$
0
0
Hi

we have a large file hosting website and the site is growing everyday and normal disks can't serve our users anymore so we bought some SSD disks and added to our servers hoping we can use the nginx caching to cache the most downloaded files but the problem we are having is that for each download our script generate a unique symlink so nginx would take that as a unique file each time and cache it, so to be realistic noun of my high download files are being read from the SSD disks because nginx wouldn't be able to tell which one is actually is getting lots of downloads, does anyone have any idea how I might be able to go around this issue?

Regards
Parham

Nginx 1.21 > 1.6 White page with php5-fpm (1 reply)

$
0
0
Hi all,
i have problem with Nginx and PHP5-fpm, if i configure Nginx 1.2.1 everything is fine, but if i upgrade to 1.6 i have only blank page. Cany anyone say why?



Socket is created fine.
Html pages working

My confing files:/etc/nginx/conf.d/web.conf

server {

listen 192.168.99.127:8080;
server_name sub.localhost;


root /home/clients_ssl/sub/www;
index index.php index.html index.htm;

location ~ \.php$ {

fastcgi_pass unix:/etc/php5/fpm/socks/ssl_sub.sock;
include fastcgi_params;
fastcgi_param HTTPS on;

}

location ~ /\. {
deny all;
}

access_log /home/clients_ssl/sub/logs/access.log;
error_log /home/clients_ssl/sub/logs/error.log;
error_page 404 /404.html;

}



-----------------------------------------------------------------------------------------------------------------------------------

/etc/nginx/nginx.conf



user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/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"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}



--------------------------------------------------------------------------------------------------------------------------

/etc/php5/fpm/pool.d/web.conf


[ssl_sub]

listen = /etc/php5/fpm/socks/ssl_sub.sock
user = nginx
group = nginx
pm = dynamic
pm.max_children = 50
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 0
php_admin_value[open_basedir]=/
php_admin_value[session.save_path]=/home/clients_ssl/sub/tmp
php_admin_value[upload_tmp_dir]=/home/clients_ssl/sub/tmp
php_admin_value[disable_functions]=dl

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

((( if i change lister.owner/group and user/group to other system user for example USER0 i have error 502 bad gateway, where is problem? ))))
----------------------------------------------------------------------------------------------------------------------

NGINX with Mac OS conf file (no replies)

$
0
0
Can anyone help please ?
I installed NGINX on mac os mavericks with passenger but when I try to stop/start nginx I get the following error:

Gabriels-Mac:gems gabrielmadeira$ sudo nginx -s stop
nginx: [emerg] invalid number of arguments in "root" directive in /usr/local/etc/nginx/nginx.conf:39

The conf file is:

#user gabrielmadeira;
worker_processes 1;



events {
worker_connections 1024;
}


http {
passenger_root /Users/gabrielmadeira/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/passenger-4.0.42;
passenger_ruby /Users/gabrielmadeira/.rvm/gems/ruby-2.1.0@filx/wrappers/ruby;

include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 64;
passenger_default_user gabrielmadeira;
passenger_default_group gabrielmadeira;
#
# server {
# listen 8080;
# server_name localhost;
#
# #charset koi8-r;
#
# #access_log logs/host.access.log main;
#
# location / {
# root html;
# index index.html index.htm;
# }
server {
listen 3000;
server_name rv.test.local;
location / {
root /Users/gabrielmadeira/Google Drive/Apps/Rep_Test/public;
passenger_app_env development;
passenger_enabled on;
}
}

server {
listen 80;
server_name rv.local;
location / {
root /Users/gabrielmadeira/Google Drive/Apps/Rep/public;
passenger_app_env staging;
passenger_enabled on;
}


#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 html;
}


# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# 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;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}
}

What am I doing wrong ?
tks

Rewite .php to end of script name failing (1 reply)

$
0
0
I want to add '.php' to the end of script that has it missing but the rewrite is failing. Not sure what is going wrong.


server{
if ( $request_uri ~* ^/announce\? ){
rewrite ^/announce(.*)$ /announce.php$1 last;
}
...
...
}

Xpost: Httpd LimitRequestFields variable in NGINX?? (no replies)

$
0
0
Hi experts,

I have been asked to update some file size limits for NGINX, however I was only given the httpd/apache setting variables.

Please let me know what the equivalent variable is for NGINX.

LimitRequestFields 300
LimitRequestFieldsSize 10485760
LimitRequestLine 10485760

I am running a php script that is loading cvs data into a MySQL database.
And received a 504 Gateway Time-out alert.

Thank you in advance
Craig.
Viewing all 2931 articles
Browse latest View live


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