Web Server - Apache and NginX
Web Server - Apache and NginX
Web Server - Apache and NginX
More
Next Blog
Create Blog
Sign In
Ads by Google
BLOG ARCHIVE
2012 (2) February (2) Reverse Proxy With Nginx How to Install Nginx WebServer 2011 (6) 2008 (1)
server { listen 80; server_name server1.com www.server1.com ; # Server Names for which you want to make this server proxy
Ads by Google
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_max_temp_file_size 0;
proxy_connect_timeout proxy_send_timeout
60; 60;
1/9/13
proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; } } For Caching contents create a file /etc/nginx/conf.d/cache.conf and enter following contents:
## Size Limits client_body_buffer_size 128K; client_header_buffer_size 1M; client_max_body_size 1M; large_client_header_buffers 8 8k;
## Timeouts client_body_timeout 60; client_header_timeout 60; expires 24h; keepalive_timeout 60 60; send_timeout 60;
## General Options ignore_invalid_headers on; keepalive_requests 100; limit_zone gulag $binary_remote_addr 5m; recursive_error_pages on; sendfile on; server_name_in_redirect off; server_tokens off;
## Compression gzip on; gzip_buffers 16 8k; gzip_comp_level 6; gzip_http_version 1.0; gzip_min_length 0; gzip_types text/plain text/css image/x-icon application/x-perl application/x-httpd-cgi; gzip_vary on;
## Log Format log_format main '$remote_addr $host $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" "$http_user_agent" ' '"$gzip_ratio" "$http_x_forwarded_for"';
This cache.conf will be used by default for all your VHOSTS content caching, so you can manage accordingly :) Start nginx service : service nginx start
apache-error.blogspot.in
2/8
1/9/13
How to Install Nginx Web Server using source code Download stable source code from http://nginx.org/download/nginx-1.0.11.tar.gz Unzip source code : tar zxvf nginx-1.0.11.tar.gz Unzipped directory should be nginx-1.0.11: cd nginx-1.0.11 Run following commands to install: ./configure --prefix=/opt/nginx (--prefix=[path where to install].... use ./configure -help to find more options to enable or disable features) make make install Start Nginx Web Server : /opt/nginx/bin/nginx Stop Nginx Web Server : /opt/nginx/bin/nginx -s stop Nginx Logs and PID file : /opt/nginx/logs/{access.log}{error.log}{nginx.pid} Thats it!!! Ref : http://wiki.nginx.org/Install http://www.thegeekstuff.com/2011/07/install-nginx-from-source/
Posted by Manoj Kumar at 3:37 AM No comments:
Apache vs NginX
Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption
apache-error.blogspot.in
3/8
1/9/13
Apache Questions
Q1 How to enable Directory Listing Ans Place "Options +Indexes" in Directory Tabs Q2 Allow Apache to use / access symbolic links directory/files Ans Place "Options +FollowSymLinks" in Directory Tabs Q3 Allow Apache to use / access .htaccess file Ans Place "AllowOverride All" in Directory Tabs Q4 Can we replace .htaccess file to some other for our convenient Ans Yes, change "AccessFileName .htaccess" to "AccessFileName .xyz" Q5 Set default number of start processes Ans Find "StartServers ..." and set as per your requirement Q6 How to disable Apache signature/version
apache-error.blogspot.in
4/8
1/9/13
Worker :- This Multi-Processing Module (MPM) implements a hybrid multiprocess multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with fewer system resources than a process-based server. However, it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads. The most important directives used to control this MPM are ThreadsPerChild, which controls the number of threads deployed by each child process and MaxClients, which controls the maximum total number of threads that may be launched Prefork :- This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-threadsafe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other. This MPM is very self-regulating, so it is rarely necessary to adjust its configuration directives. Most important is that MaxClients be big enough to handle as many simultaneous requests as you expect to receive, but small enough to assure that there is enough physical RAM for all processes.
Q13 Write a Rewrite rule to redirect (www).abc.com/request.php to www.abc.com/request1.php Ans RewriteEngine On RewriteCond %{HTTP_HOST} ^abc.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.abc.com$ [NC] RewriteRule ^/request.php$ http://www.abc.com/request1.php [L] Q14 How many connections apache server can handle Ans This completely depends on our server configuration mainly on RAM Max no. of connections = (Total Memory - Memory Used By System For Its use) / average single apache process size* *Average Single Apache Process Size : Can be find using "top" command or "ps -ylC httpd --sort rss"
To be continued....
apache-error.blogspot.in
5/8
1/9/13
How to Setup Name Based Virtual Hosting and IP Based Virtual Hosting? Name Based Virtual Host : edit /etc/httpd/conf/httpd.conf Listen 192.168.1.1:80
apache-error.blogspot.in
6/8
1/9/13
VirtualHost 192.168..1.1:80 ServerName fistsite.com ServerAlias www.firstsite.com DocumentRoot /var/www/html/firstsite Directory /var/www/html/firstsite AllowOverride None Options -Indexes -FollowSymLinks Order allow, deny Allow from All /Directory CustomLog logs/firstsite_access.log common ErrorLog logs/firstsite_error.log /VirtualHost -----------------------------------------------------------------------------------------------IP Based Virtual Host:
VirtualHost 192.168..1.1:80 ServerName localhost ServerAlias localhost.localdomain DocumentRoot /var/www/html Directory /var/www/html AllowOverride None Options -Indexes -FollowSymLinks Order allow, deny Allow from All /Directory CustomLog logs/localhost_access.log common ErrorLog logs/localhost_error.log /VirtualHost
VirtualHost 192.168..1.2:80 ServerName fistsite.com ServerAlias www.firstsite.com DocumentRoot /var/www/html/firstsite Directory /var/www/html/firstsite AllowOverride None Options -Indexes -FollowSymLinks Order allow, deny Allow from All /Directory CustomLog logs/firstsite_access.log common
apache-error.blogspot.in
7/8
1/9/13
Older Posts
apache-error.blogspot.in
8/8