I have a set of rewrite rules as rewrite ^/(.*) /script.php?file=$1 last; location ~ \.php$ { php proxy } but I want to make a few exceptions as location = file1|file2|file3 { static delivery } but rewrite will change any static file to php file before the latter location. I cannot use rewrite inside the location, as it should generate php script before location (and I have oby etrader - Nginx Mailing List - English
In a server as server { server_name domain.com *.domain.com root /var/www/$server_name; } is it possible to set locations for subdomains based on subfolders of the $server_name ? location matching sub1.domain.com { serving from /var/www/$server_name/sub1 } Currently, I am using a server for each subdomain, but when the number of subdomains increases, maintaining numerous serverby etrader - Nginx Mailing List - English
Thanks for very subtle suggestion. I do agree with you and follow this strategy (to use programming language for processing the url arguments).by etrader - Nginx Mailing List - English
I have a set of rewrites as rewrite ^/(.*)/(.*)/(.*)\.(.*) /script.php?a=$1&b=$2&c=$3&ext=$4 last; rewrite ^/(.*)/(.*)\.(.*) /script.php?a=$1&b=$2&ext=$3 last; rewrite ^/(.*)\.(.*) /script.php?a=$1&ext=$2 last; rewrite ^/(.*)/(.*)/(.*)/(.*) /script.php?a=$1&b=$2&c=$3&d=$4 last; rewrite ^/(.*)/(.*)/(.*) /script.php?a=$1&b=$2&c=$3 last; rewrite ^/(by etrader - Nginx Mailing List - English
For serving the PHP scripts, I use this location location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } now I want to keep a folder outside the public folder to be served as a location /private/ { /* serving static files from /private/$server_name/ */ locatby etrader - Nginx Mailing List - English
Anton Yuzhaninov Wrote: ------------------------------------------------------- > > rewrite ^/favicon.ico /var/www/media/images/favicon.X.ico last; > > This is wrong - you can rewrite to other location, not to path on file > system. > Anyway rewrite does not need here, use location. Sorry, my bad! In the second case, I meant rewrite ^/favicon.ico /media/images/faviconby etrader - Nginx Mailing List - English
I want to server favicon from a different place rather than the root folder. As I explored I have two options 1. location = /favicon.ico { alias /var/www/media/images/favicon.X.ico; } 2. rewrite ^/favicon.ico /var/www/media/images/favicon.X.ico last; As I understand the second one needs an additional regex check for every request to check if the url is favicon or not (imagine that we hby etrader - Nginx Mailing List - English
I want to rewrite subdomains by adding a separate server for subdomains as server { server_name domain.com ... } server { server_name *.domain.com } but how I can I ass a rewrite rule int the second server to process subdomain requests as keyword.domain.com/query=some to domain.com/script.php?query=some&sub=keywordby etrader - Nginx Mailing List - English
FastCGI is language-independent and like cgi can serve all languages, but setting up nginx with fcgiwrap and spawn-fcgi is only used for serving Perl. Almost all tutorials and instructions use this method for Perl-FasctCGI. For serving Pythong scripts, the dominant method is uWSGI. Is there any limitation for using FastCGI for Python that it is not usual? or the reason is merely that uWSGI is bby etrader - Nginx Mailing List - English
I was using wildcard for including all subdomains for a server_name as server_name domain.com; I just installed nginx 1.2.3, but this configuration no longer works and subdomains lead to nginx 404 page. Since I followed a standard procedure of installation via apt-get, I suspect something has been changed in new versions of nginx. Now, I can only use wildcard for subdomains with serverby etrader - Nginx Mailing List - English
Thanks Andrejs! Sorry, it was my failure! locojohn Wrote: ------------------------------------------------------- > In php.ini: > > expose_php = off > > Actually, you could do some googling before asking > a question. > > Andrejsby etrader - Nginx Mailing List - English
I add custom X-Powered-By with "add_header X-Powered-By custom;" However, when serving PHP fastcgi in the location, PHP X-Powered-By will also be added to make the X-Powered-By as X-Powered-By: PHP/5.3.3-1ubuntu9.10 custom How can I totally remove PHP X-Powered-By to have my own custom one only?by etrader - Nginx Mailing List - English
Serving static files is the native behavior of nginx, and when we use gateway for scripting, it needs more works by nginx. Thus, loading a php file should take more time than loading an image file. I compare the speed of loading an image file with serving via php by $image=imagecreatefromjpeg($imagepath); header('Content-Type: image/jpeg'); imagejpeg($image); Surprisingly (at least to mby etrader - Nginx Mailing List - English
I have a simple re-write of rewrite ^/(.*) /post.php?id=$1 last; This will breaks my main index page, as domain.com will also be redirected to "post.php?id=" How can I modify my regular expression not to change the main index page?by etrader - Nginx Mailing List - English
I want to set a rewrite rule for redirection of search.php?q=word to word.domain.com I used the following rule but did not work. rewrite ^(.*).$server_name /search.php?q=$1 permanent;by etrader - Nginx Mailing List - English
Thanks Brian, I always had this doubt whether it is good to have more workers (comparing to the number of CPUs) or not.by etrader - Nginx Mailing List - English
Thanks for very useful description, Maxim! Actually, I suspected the nature of 0.000 request time; but what makes me wonder is that it takes only 3ms to process a relatively php file with output of 5KB. Then, why reading a static file of 15KB should take 600ms? If it is normally the case, isn't it better to save images as data instead of file? PHP should process a base64 string faster.by etrader - Nginx Mailing List - English
I have a strange problem with slow load of relatively large files. On a domain without proxy (designed for serving static files), the request time (as monitored by access log $request_time) for an simple jpg image file of 5KB is 0.000s (seems to be shorter than 1ms). Thus, one expect to load an image file of 15KB within 3ms, but surprisingly it takes about 600ms. A static file of 15KB is not bigby etrader - Nginx Mailing List - English
I want to create a config for domains serving static content. I made the following conf file. Is it the best possible code? (I just kept php interpretation for possible usage) location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|wma|wmv)$ { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remotby etrader - Nginx Mailing List - English
Thanks James! The idea of building a mini-webserver for C programming is brilliant. I searched a lot to find a guidance for building very basic web server in C (obviously I prefer to write the web server in C with native API for C files); but I was unable to find. All web servers in C are advanced applications such as nginx. Could you please give me a hint how to start to write a mini web serverby etrader - Nginx Mailing List - English
I am using php in nginx. I wonder how can I modify nginx configuration to work with C too. Considered a simple c file (hello.c and compiled as a.out) with printf of printf("Content-type: text/html\r\nStatus: 200 OK\r\n\r\n"); printf("Hello World"); how can I display Hello World by browsing the compiled version on localhost/a.outby etrader - Nginx Mailing List - English
Thanks fellas. This is exactly what I was looking for :)by etrader - Nginx Mailing List - English
I've tried most of lightweight web servers, and nginx is truly amazing and my beloved webserver. Thus, I decided to profoundly study nginx to better understand it. The oldest version available for download is 0.5 I wonder if there is a repository to download earlier versions of nginx? And is there a version working without installation? I mean very basic version that works just by running ngby etrader - Nginx Mailing List - English
As I explored, simply removing access_log and error_log from nginx configuration makes the process for nginx more complicated; thus, it takes more time to complete the request. Instead, error_log should be turned off by error_log /dev/null crit; but how to turn off the access log? And what is the best configuration to force nginx to conduct the main requests without dealing with side procesby etrader - Nginx Mailing List - English
Obviously nginx needs a time (even very short) to write access and error logs upon every request. Thus, theoretically, removing access and error logs from nginx configuration should speed up the web server. Surprisingly, when I did so, the load of my website became slower. Is it normal? NOTE: I know that logs are useful and needed for real experiences; I just try to better understand nginx as mby etrader - Nginx Mailing List - English
Adrenalin Wrote: ------------------------------------------------------- > Maybe you should make shm_size lower in this > case. > Do you really need 64M for every process ? Do you > really need 200 child ? > How to set the memory for every process?by etrader - Php-fpm Mailing List - English
Exploring the webpage load by pingdom service, I just found that the main delay of page load is due to slow load of images. The images come from a cookieless domain. I changed the nginx conf for that domain as location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|wma|wmv)$ { proxy_redirect off; proxy_set_header Host $host;by etrader - Nginx Mailing List - English
Thanks Daniel! I run nginx (1.0.4 or 1.0.5) on different servers, but in general, they are based on Centos or Ubuntu running php via php-fpm.by etrader - Nginx Mailing List - English
Is there a special configuration for static content like image files? I have no problem with nginx, and the reason that I am asking is to know if there is a different nginx conf to load static files faster.by etrader - Nginx Mailing List - English
I have a Nginx installed on Linux (Ubuntu or Centos) without any scripting language such as PHP or Python (connected to the webserver). Can I run Shell commands from a webpage (e.g. html)? I mean is it possible to use nginx without script languages by shell scripts?by etrader - Nginx Mailing List - English
![]() |
![]() |
![]() |
![]() |
![]() |