Full configuration parameters for Nginx configuration file nginx.conf

Source: Internet
Author: User

1, nginx.conf

User nginx nginx;worker_processes 4;error_log /var/log/nginx/error.log notice;pid        /var/run/nginx.pid;worker_rlimit_nofile 65535;events{     use epoll;    worker_connections 65535;} http{    include mime.types;    default_type application/ Octet-stream;    server_names_hash_bucket_size 3526;    server_ names_hash_max_size 4096;    log_format  main   ' $remote _addr  -  $remote _user [$time _local]  "$request"   "                        ' $status   $body _ bytes_sent  "$http _referer"                           ' "$http _user_agent"   "$http _x_forwarded_for" ';    sendfile on;     tcp_nopush on;    tcp_nodelay on;     Keepalive_timeout 60;    send_timeout 120;    client_header_ Timeout 3m;    client_body_timeout 3m;    client_max_body_ Size 100m;    client_body_buffer_size 4k;    client_header_ buffer_size 128k;    large_client_header_buffers 4 64k;     connection_pool_size 256;    request_pool_size 8k;     output_buffers 4 32k;    postpone_output 1460;     client_body_temp_path /tmp/nginx/client_body;    proxy_temp_path /tmp/nginx/ Proxy;    gzip on;    gzip_min_length 1k;    gzip_buffers 4 16k ;    gzip_comp_level 3;    gzip_http_version 1.1;     gzip_types text/plain application/x-javascript text/css text/htm  Application/xml;    gzip_vary on;    fastcgi_connect_timeout  300;    fastcgi_send_timeout 300;    fastcgi_read_timeout  300;    fastcgi_buffer_size 64k;    fastcgi_buffers 4  64k;    fastcgi_busy_buffers_size 128k;    fastcgi_temp_ file_write_size 128k;    fastcgi_temp_path /tmp/nginx/fastcgi;     fastcgi_intercept_errors on;    include vhosts/*.conf;}


2, Nginx server_conf

server {    listen      80;     server_name 172.15.1.11;    index index.html index.htm index.php  index.jsp;    server_tokens       off;     root        /data/www/html;    access_ log  /var/log/nginx/www_access.log main;    location ~ \.php$  {        include fastcgi_params;         fastcgi_pass unix:/var/lib/php/php-fcgi.sock;         fastcgi_index index.php;        fastcgi_param  script_filename /data/www/html$fastcgi_script_name;    }     Location ~* \. (jsp|jspx|do) $ {        proxy_pass http://192.168.1.231:8080;     }    location ~* ^.+\. (gif|jpg|png|ioc|swf|flv|rar|zip|doc|ppt|pdf|gz|bz2|jpeg|bmp|xls|mid|mp3|wma) $ {         expires        7d;         root   /data/www/html;         Access_log     off;        valid_referers  none blocked *.huangming.org huangming.org 172.15.1.11;           if  ($invalid _referer)                  {                   return 403;                }      }           location ~ .*\. (JS|CSS)?$ {        expires          24h;        access_log       off;    }    location ~  (Static|cache)  {         access_log      off;     }    location /NginxStatus {         stub_status     on;        access_log       /var/log/nginx/NginxStatus.log;         auth_basic       "Nginxstatus";         auth_basic_user_file     /etc/nginx/htpasswd;    }}


3. Nginx Status

Location/nginxstatus {stub_status on;        Access_log/var/log/nginx/nginxstatus.log;        Auth_basic "Nginxstatus";    AUTH_BASIC_USER_FILE/ETC/NGINX/HTPASSWD; }# Yum Install httpd# htpasswd-c/etc/nginx/htpasswd adminnew password:re-type new password:adding password for user ad Min


4, php-fpm

# vim /usr/local/php/etc/php-fpm.conf[global]pid = /usr/local/php/var/run/php-fpm.piderror _log = /usr/local/php/var/log/php-fpm.log[www]listen = /var/lib/php/php-fcgi.sockuser  = php-fpmgroup = php-fpmlisten.owner = nginxlisten.group = nginxpm  = dynamicpm.max_children = 100pm.start_servers = 20pm.min_spare_servers =  5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024slowlog  = /var/log/php/www_slow.logrequest_slowlog_timeout = 1php_admin_value[open_basedir]=/data /www/:/tmp/# /usr/local/php/sbin/php-fpm -t[29-apr-2016 04:11:02] notice:  Configuration file /usr/local/php/etc/php-fpm.conf test is successful# service  php-fpm restartGracefully shutting down php-fpm . doneStarting  Php-fpm  done


5. Create Data

Mysql> CREATE DATABASE discuz;mysql> GRANT all on discuz.* to [e-mail protected] ' 172.15.1.% ' identified by ' discuz '; m ysql> FLUSH privileges;


6, Iptables

#!/bin/bashiptables-fiptables-xiptables-ziptables-p INPUT dropiptables-p OUTPUT acceptiptables-p FORWARD ACCEPTiptab Les-a input-p icmp-j acceptiptables-a input-i lo-j acceptiptables-a input-s 127.0.0.1-j acceptiptables-a INPUT- P TCP--dport 22-j acceptiptables-a input-p tcp--dport 80-j acceptiptables-a input-p tcp--dport 3306-s 172.15.1.0 /24-j acceptiptables-a input-m State--state related,established-j accept# Getenforce Disabled






Full configuration parameters for Nginx configuration file nginx.conf

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.