CentOS-5.1 Yum install nginx + PHP-FPM + MySQL notes

Source: Internet
Author: User
Tags sendfile

The installation was completed yesterday. The notes are as follows:

First create a repo # vi/etc/yum. repos. d/centos.21andy.com. repo [21andy.com] Name = 21andy.com packages for Enterprise Linux 5-$ basearchbaseurl = paiepel repoi 386rpm-ihv restart -- import/etc/pki/rpm-GPG-key- epelyum install nginx PHP-FPM mysql-serveryum-y Mysql-serverservice mysqld startmysqladmin-u Root Password rootservice mysqld stop to check my complete installation, just enter Yum-y install nginx mysql-server PHP-fpm php-cli PHP-pdo php-mysql PHP-mcrypt PHP-mbstring PHP-Gd PHP-tidy PHP-xml php- xmlrpc php-pear PHP-PECL-memcache PHP-eacceleratoryum-y updatechkconfig -- level 345 mysqld onchkconfig -- level 345 PHP-FPM onchkconfig -- level 345 nginx ongroupadd wwwuseradd-G WWW Wwwmkdir-P/www/logs/chown-RVF www: www/VI/etc/nginx/fastcgi_paramsfastcgi_param script_filename $ document_root $ fastcgi_script_name; # zhangtuo editmv/etc/nginx. conf/etc/nginx. conf_bak_zhangtuovi/etc/nginx. confuser WWW; worker_processes 8; error_log/www/logs/nginx_error.log crit; PID/www/logs/nginx. PID; # specifies the value for maximum file descriptors that can be ope Ned by this process. worker_rlimit_nofile 51200; events {use epoll; worker_connections 51200;} HTTP {include mime. types; default_type application/octet-stream; # charse gb2312; # ~è ± à £;***» éöserver_names_hash_bucket_size 128; client_header_buffer_size 16 K; limit 4 16 K; client_max_body_size 8 m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_ti Meout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; Limit 64 K; fastcgi_buffers 4 64 K; Limit 128 K; Limit 128 K; gzip on; gzip_min_length 1 K; gzip_buffers 4 16 K; gzip_http_version 1.0; gzip_comp_level 5; gzip_types text/plain text/JavaScript Application/X-JavaScript text/CSS application/XML; gzip_vary on; # limit_zone crawler $ binary _ Remote_addr 10 m; server {Listen 80; SERVER_NAME localhost; root/www/wwwroot/; Location/status {stub_status on; access_log off ;} location/{try_files $ URI // error. PHP? Q = $ URI & $ ARGs;} include server. conf; log_format access' $ remote_addr-$ remote_user [$ time_local] "$ request" ''$ Status $ response" $ http_referer "'' "$ http_user_agent" $ http_x_forwarded_for '; access_log/www/logs/access. log Access;} vi/etc/nginx/server. confindex index.html index.htm index. PHP; # limit_conn crawler 20; location ~ /\. Ht {deny all;} location ~. * \. (SQLite | sq3) $ {deny all;} location ~ \. Php $ {root/www/wwwroot; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; # fastcgi_param script_filename $ document_root $ fastcgi_script_name; Include fastcgi_params;} location ~. * \. (GIF | JPG | JPEG | PNG | BMP | SWF | ico) $ {expires 30d; access_log off;} location ~. * \. (JS | CSS )? $ {Expires 30d; access_log off;} service mysqld stopmysqld_safe -- skip-grant-tables & mysqluse mysqlupdate user SET Password = PASSWORD ("bangian2008") where user = 'root '; service mysqld start
 

The complete nginx. conf file is as follows:

user www www;worker_processes 8;error_log  /www/logs/nginx_error.log  crit;pid /www/logs/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.worker_rlimit_nofile 51200;events {    use epoll;    worker_connections 51200;}http {    include       mime.types;    default_type  application/octet-stream;    #charse  gb2312; # Ĭȱ࣬¿ÉԲ»ÉÖ    server_names_hash_bucket_size 128;    client_header_buffer_size 16k;    large_client_header_buffers 4 16k;    client_max_body_size 8m;    sendfile on;    tcp_nopush     on;    keepalive_timeout 60;    tcp_nodelay 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;    gzip on;    gzip_min_length  1k;    gzip_buffers     4 16k;    gzip_http_version 1.0;    gzip_comp_level 5;    gzip_types       text/plain text/javascript application/x-javascript text/css application/xml;    gzip_vary on;    #limit_zone  crawler  $binary_remote_addr  10m;    server {        listen 80;        server_name localhost;        root  /www/wwwroot/;        location /status {            stub_status on;            access_log  off;        }        location / {            try_files $uri $uri/ /index.php?q=$uri&$args;        }                include server.conf;        log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '             '$status $body_bytes_sent "$http_referer" '             '"$http_user_agent" $http_x_forwarded_for';        access_log  /www/logs/access.log  access;    }}

The contents of the complete server. conf file are as follows:

index index.html index.htm index.php;#limit_conn   crawler  20;location ~ /\.ht {    deny all;}location ~ .*\.(sqlite|sq3)$ {    deny all;}location ~ \.php$ {    root           /www/wwwroot;    fastcgi_pass   127.0.0.1:9000;    fastcgi_index  index.php;    #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;    include        fastcgi_params;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$ {    expires      30d;    access_log   off;}location ~ .*\.(js|css)?$ {    expires      30d;    access_log   off;}

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.