Browsing articles tagged with "nginx - 4/102 - Admins Goodies"
Oct 23, 2012
tom

how exactly does nginx/php-fpm process requests?

I’m currently testing a new nginx/php-fpm I have setup on a new VPS with 4GB of RAM: from my php-fpm process pool config: pm = static pm.max_children = 10 I have a simple load.php script which has the following simulate a long running mysql query: <?php echo sleep(5); echo “you see me after 5 seconds”; ?> I then throw some load at this script as follows: ab -n 1000 -c 100 http://mydomain.com/load.php When I tail […]

Continue Reading »
Oct 21, 2012
tom

Set global handling for PHP scripts in NGINX + PHP-FPM

I have to define fastcgi_pass for every virtual host. How do I define it global-wise? server { listen 80; server_name www.domain.tld; location / { root /home/user/www.domain.tld; index index.html index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/user/domain.tld$fastcgi_script_name; include fastcgi_params; }} Asked by Radio Make a file that you can include wherever you need it. For instance: cat > /etc/nginx/php-fpm <<EOF fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; EOF Then […]

Continue Reading »
Oct 21, 2012
tom

Nginx Rewrite Rule To 301 redirect filename.asp to filename.php

I have changed my file names from filename.asp to filename.php but now I want to 301 redirect all the requests coming to filename.asp to its equivalent filename.php I have tried these variations but they only redirect to the homepage: if ($request_uri ~ .*.asp.*) { rewrite ^ http://$host? permanent; #rewrite ^/(.*)$ /$1.php permanent; } domain.com/folder/filename.asp 301 redirect to domain.com/folder/filename.php Thanks Asked by webnise You don’t need the if to get just the .asp files, it can […]

Continue Reading »
Oct 20, 2012
tom

Which tools should I use to work efficiently on a remote server?

I rented a virtual ubuntu server and am trying to setup a web application. I am working from ubuntu. I know how to use the command line, but it is slow and as a visual person, I prefer graphical interfaces. So I connected with nautilus via ssh and was now able to browse the directories graphically. But my permissions are just those of “other”, so I cannot do much without o+rwx. What tools do you […]

Continue Reading »
Oct 20, 2012
tom

Nginx reverse proxy and IIS

I’m using nginx as a reverse proxy for website running on IIS 7.5. Website is bound to sub-1.foo.bar. Nginx configuration looks like this: server { listen 80; server_name sub.foo.bar; location / { proxy_pass http://sub-1.foo.bar; proxy_set_header Host $host; proxy_set_header X-Accel-Expires 0; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } What I want to do is forward requests which come to sub.foo.bar (linux machine with nginx) to sub-1.foo.bar (windows machine with IIS and my website). However what […]

Continue Reading »
Oct 15, 2012
tom

Nginx proxy pass works for https but not http

I want to redirect HTTP traffic and HTTPS traffic to a backend Flask application and I have the snippet below in my nginx.conf which works for https but not for http server { listen 80; listen 443 ssl; ssl_certificate /usr/local/nginx/server.crt; ssl_certificate_key /usr/local/nginx/server.key;location / { proxy_redirect off; proxy_cache off; proxy_pass http://127.0.0.1:5000; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } Does anyone have any pointers? Is there something obvious in the config file snippet […]

Continue Reading »
Oct 13, 2012
tom

Nginx location to match query parameters

Is it possible in nginx to have a location {} block that matches query parameters. For example I want to pick up that “preview=true” in this url and then instruct it to do several different things, all possible in a location block. http://192.158.0.1/web/test.php?hello=test&preview=true&another=var The problem I’m having is that my test stuff doesn’t seem to match, it seems like I can only match the URL itself? E.g. location ~ ^(.*)(preview)(.*)$ Or something aloong those lines? […]

Continue Reading »
Oct 11, 2012
tom

Install php-fpm + php-mysql + MariaDB on Centos from repos

I try to take CentOS 6.4 x64 and install nginx w/ php-fpm on it (and that’s easy part, no problem at all), then add php-mysql package and MariaDB as a mysql drop-in replacement. And here I face the hang… I’ve added epel, nginx and remi repos, add priority=10 line to its .repo files, and now as I install MariaDB-server the dependency also brings me MariaDB’s “common” package. Then, as I try to install php-mysql, I […]

Continue Reading »
Oct 7, 2012
tom

Strategy to isolate multiple nginx ssl apps with single domain via suburi’s?

Warning: so far I have only learnt how to use nginx to serve apps with their own domain and server block. But I think its time to dive a little deeper. To mitigate the need for multiple SSL certificates or expensive wildcard certificates I would like to serve multiple apps (e.g. rails apps, php apps, node.js apps) from one nginx server_name. e.g. rooturl/railsapp rooturl/nodejsapp rooturl/phpshop rooturl/phpblog I am unsure on ideal strategy. Some examples I […]

Continue Reading »
Oct 1, 2012
tom

ISPconfig found Apache instead of NGINX

I installed ISPConfig and it detected Apache because I didn’t uninstall it when I switched to Nginx. I figured I could just remove apache (httpd) and re-run the update script for ISPconfig, however it still seems to find apache. Is there a way of getting ISPconfig to detect Nginx not Apache. I am surprised it didn’t give me the choice like the documentation suggested it would. Asked by Adripants I had to use the uninstall.php […]

Continue Reading »
Pages:«1234567...102»