昨天完成安裝,筆記如下
先建立一個 repo# vi /etc/yum.repos.d/centos.21andy.com.repo[21Andy.com]name=21Andy.com Packages for Enterprise Linux 5 - $basearchbaseurl=http://www.21andy.com/centos/5/$basearch/enabled=1gpgcheck=0protect=1啟用 EPEL repoi386rpm -ihv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm接著匯入keyrpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPELyum install nginx php-fpm mysql-serveryum -y mysql-serverservice mysqld startmysqladmin -u root password rootservice mysqld stop看下我的完整安裝,只要一句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 /www/vi /etc/nginx/fastcgi_paramsfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # zhangtuo editmv /etc/nginx/nginx.conf /etc/nginx/nginx.conf_bak_zhangtuovi /etc/nginx/nginx.confuser 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/ /error.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; }}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
完整的nginx.conf 檔案如下
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; }}
完整的server.conf檔案內容如下
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;}