Imagine,you’ve got a task now to verify a bulk of domains the speed of response and whether they are active or not.Here a bulk of,means,for example,1,000.On getting this task,what will you do next?Type in every ip in the command line in Microsoft’s cmd and waits for the result?1,000,you must consider it.You may imagine,how tired after you’ve pinged the full 1,000 of the urls.
Here is my implement of the task.Firstly,put the urls in domain.txt,one url per line.Then run the script:sh if.sh.Lastly,waits for the result in ip.txt.During the execution time,you may go out and breath fresh air or have a cup of tea,not type in the Microsoft cmd any more! Read more…
Sometimes,we want to see the compiled parameters of nginx,apache,mysql,php etc. after the compilation.Consider the following method.
nginx compilation parameters:
#/usr/local/nginx/sbin/nginx -V
nginx version: nginx/0.6.32 built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42) configure arguments: –user=www –group=www –prefix=/usr/local/nginx/ –with-http_stub_status_module –with-openssl=/usr/local/openssl
apache compilation parameters:
# cat /usr/local/apache2/build/config.nice
#! /bin/sh # # Created by configure “./configure” \ “–prefix=/usr/local/apache2″ \ “–with-included-apr” \ “–enable-so” \ “–enable-deflate=shared” \ “–enable-expires=shared” \ “–enable-rewrite=shared” \ “–enable-static-support” \ “–disable-userdir” \ “$@”
php compilation parameters:
# /usr/local/php/bin/php -i |grep configure
Configure Command => ‘./configure’ ‘–prefix=/usr/local/php’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–with-config-file-path=/usr/local/php/etc’ ‘–with-mysql=/usr/local/mysql’ ‘–with-libxml-dir=/usr/local/libxml2/bin’ ‘–with-gd=/usr/local/gd2′ ‘–with-jpeg-dir’ ‘–with-png-dir’ ‘–with-bz2′ ‘–with-xmlrpc’ ‘–with-freetype-dir’ ‘–with-zlib-dir’
mysql compilation parameters:
# cat “/usr/local/mysql/bin/mysqlbug”|grep configure
# This is set by configure CONFIGURE_LINE=”./configure ‘–prefix=/usr/local/mysql’ ‘–localstatedir=/var/lib/mysql’ ‘–with-comment=Source’ ‘–with-server-suffix=-H863′ ‘–with-mysqld-user=mysql’ ‘–without-debug’ ‘–with-big-tables’ ‘–with-charset=gbk’ ‘–with-collation=gbk_chinese_ci’ ‘–with-extra-charsets=all’ ‘–with-pthread’ ‘–enable-static’ ‘–enable-thread-safe-client’ ‘–with-client-ldflags=-all-static’ ‘–with-mysqld-ldflags=-all-static’ ‘–enable-assembler’ ‘–without-isam’ ‘–without-innodb’ ‘–without-ndb-debug’”
vhcs2_debian.sh,chmod +x ./vhcs2_debian.sh,./vhcs2_debian.sh.In the process,you must type in the main ip of your server.And,set the parameters during the installation(for example,mysql password etc.)
Here it goes: Read more…
To put an elephant into a fridge-three steps(which I think you already knew it):
Firstly(open the fridge):In nginx,add a line in /usr/local/nginx/conf/proxy.conf:
proxy_set_header X-Real-IP $remote_addr;
#Note:Add this just in proxy.conf,repetitive addition in nginx.conf location and server place will result your backend server log repetitive times.
Secondly(put the elephant in):In backend apache server,add the following lines in place VirtualHost or Server: Read more…
This script by me accomplish the auto installation of nginx reverse server under centos.Please modify upstream and server_name scope in nginx.conf after the installation.And you do not need to modify proxy.conf(Of course,you can.For example,to get the real user ip in backend apache server).
Here the script goes: Read more…
This script by me accomplish the auto installation of nginx reverse server under debian.Please modify upstream and server_name scope in nginx.conf after the installation.And you do not need to modify proxy.conf(Of course,you can.For example,to <a href=”http://www.doxer.org/learn-linux/nginx-real-userip/” target=”_blank”></a>
Here the script goes:
#!/bin/bash
#nginx_debian.sh
#by doxer.org
#note:you should killall nginx and change the port of apache2 to 81 and restart apache2 after running the script
echo -e “deb http://ftp.debian.org/debian/ lenny main contrib non-free\ndeb http://security.debian.org/ lenny/updates main contrib non-free”>>/etc/apt/sources.list
apt-get update
apt-get install gcc g++ make patch libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
cd ~
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.9.tar.gz
tar zxvf pcre-7.9.tar.gz
cd pcre-7.9/ #pwd /root/downloads/pcre-7.9
./configure
make && make install
cd ..
wget http://sysoev.ru/nginx/nginx-0.7.30.tar.gz
tar -zxvf nginx-0.7.67.tar.gz
cd nginx-0.7.30
./configure –sbin-path=/usr/local/nginx/sbin –with-http_ssl_module –with-http_stub_status_module
make && make install
#rm -rf /etc/nginx/sites-enabled/default
groupadd www
useradd -g www www
echo -e ‘user www www;
worker_processes 4;
error_log /usr/local/nginx/logs/error.log crit;
pid /usr/local/nginx/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
include proxy.conf;
default_type application/octet-stream;
charset utf-8;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
gzip on;
gzip_min_length 1k;
#gzip_buffers 4 1
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
upstream localhost{
server 127.0.0.1:81;
}
server{
listen 80;
server_name _;
location / {
proxy_pass http://localhost;
}
}
}’>/usr/local/nginx/conf/nginx.conf
echo -E ‘proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header Port $proxy_port;
proxy_set_header XHost $host:$proxy_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header HTTP_CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_buffers 32 4k;
proxy_buffer_size 16k;’>/usr/local/nginx/conf/proxy.conf
Ok.That’s all.Now bootstrap from start the nginx server:/usr/local/nginx/sbin/nginx.Change the listening port on apache to 81(NameVirtualHost *:81 and <VirtualHost *:81>).Visit your site and now take a look at the response header sent by your nginx reverse server.You will find Server:nginx/0.7.30 in your firebug’s Net label.Enjoy the high concurrent processing ability of nginx now!
Related:Install nginx reverse proxy server under centos(bash shell)