Centos nginx installation document 0.8.x

Source: Internet
Author: User
Tags openldap

1. obtain basic open-source programs:

Yum-y install gcc-c ++ autoconf libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses- devel curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn-devel openssl-devel openldap-devel nss_ldap openldap-clients openldap-servers

2. Two RPM packages are recommended to search websites.

Http://rpm.pbone.net/
Http://www.rpmfind.net/

3. Run the command rpm-qa | grep libjpeg to check whether the preceding packages exist. Otherwise, library support is missing during installation.

Rpm-ivh (filename) is the command for installing the RPM package

4. Obtain the nginx source code package

Wget http://sysoev.ru/nginx/nginx-0.8.46.tar.gz

Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz (library support required to install nginx)

5. Create www: www users and groups

Groupadd www

Useradd-g www

 

Install nginx under/usr/local/webserver/

In the future, place the web program under/var/www /.

 

@ 1 install the pcre Library required by Nginx:

@ 2 install Nginx

 

Ruby code
  1. Tar zxvf nginx-0.8.46.tar.gz
  2. Cd nginx-0.8.46/
  3. ./Configure -- user = www -- group = www -- prefix =/usr/local/webserver/nginx -- with-http_stub_status_module -- with-http_ssl_module
  4. Make & make install
  5. Cd ../
tar zxvf nginx-0.8.46.tar.gzcd nginx-0.8.46/./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_modulemake && make installcd ../

@ 3 create an Nginx log directory

 

Ruby code
  1. Mkdir-p/data1/logs
  2. Chmod + w/data1/logs
  3. Chown-R www: www/data1/logs
mkdir -p /data1/logschmod +w /data1/logschown -R www:www /data1/logs

Nginx. conf recommended online

Mv/usr/local/webserver/nginx/conf/nginx. conf/usr/local/webserver/nginx/conf/nginx. conf. bak
Vi/usr/local/webserver/nginx/conf/nginx. conf

Ruby code
  1. User www;
  2. Worker_processes 8;
  3. Error_log/data1/logs/nginx_error.log crit;
  4. Pid/usr/local/webserver/nginx. pid;
  5. # Specifies the value for maximum file descriptors that can be opened by this process.
  6. Worker_rlimit_nofile 65535;
  7. Events
  8. {
  9. Use epoll;
  10. Worker_connections 65535;
  11. }
  12. Http
  13. {
  14. Include mime. types;
  15. Default_type application/octet-stream;
  16. # Charset gb2312;
  17. Server_names_hash_bucket_size 128;
  18. Client_header_buffer_size 32 k;
  19. Large_client_header_buffers 4 32 k;
  20. Client_max_body_size 8 m;
  21. Sendfile on;
  22. Tcp_nopush on;
  23. Keepalive_timeout 60;
  24. Tcp_nodelay on;
  25. Fastcgi_connect_timeout 300;
  26. Fastcgi_send_timeout 300;
  27. Fastcgi_read_timeout 300;
  28. Fastcgi_buffer_size 64 k;
  29. Fastcgi_buffers 4 64 k;
  30. Fastcgi_busy_buffers_size 128 k;
  31. Fastcgi_temp_file_write_size 128 k;
  32. Gzip on;
  33. Gzip_min_length 1 k;
  34. Gzip_buffers 4 16 k;
  35. Gzip_http_version 1.0;
  36. Gzip_comp_level 2;
  37. Gzip_types text/plain application/x-javascript text/css application/xml;
  38. Gzip_vary on;
  39. # Limit_zone crawler $ binary_remote_addr 10 m;
  40. Server
  41. {
  42. Listen 80;
  43. Server_name <A href = "http://www.test.com; % 09"> www.test.com;
  44. </A> index index.html index.htm index. php;
  45. Root/data0/htdocs/blog;
  46. # Limit_conn crawler 20;
  47. Location ~ . * \. (Php | php5 )? $
  48. {
  49. # Fastcgi_pass unix:/tmp/php-cgi.sock;
  50. Fastcgi_pass 127.0.0.1: 9000;
  51. Fastcgi_index index. php;
  52. Fcinclude gi. conf;
  53. }
  54. Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf) $
  55. {
  56. Expires 30d;
  57. }
  58. Location ~ . * \. (Js | css )? $
  59. {
  60. Expires 1 h;
  61. }
  62. Log_format access' $ remote_addr-$ remote_user [$ time_local] "$ request "'
  63. '$ Status $ body_bytes_sent "$ http_referer "'
  64. '"$ Http_user_agent" $ http_x_forwarded_for ';
  65. Access_log/data1/logs/access. log access;
  66. }
  67. }
Ruby code
  1. Tar zxvf pcre-8.10.tar.gz
  2. Cd pcre-8.10/
  3. ./Configure
  4. Make & make install
  5. Cd ../
tar zxvf pcre-8.10.tar.gzcd pcre-8.10/./configuremake && make installcd ../

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.