准备工作
cd/usr/local/src wgethttp://mirrors.sohu.com/MysqL/MysqL-5.6/MysqL-5.6.35-linux-glibc2.5-x86_64.tar.gz wgethttp://cn2.PHP.net/distributions/PHP-5.6.30.tar.gz wgethttp://Nginx.org/download/Nginx-1.12.1.tar.gz tarzxfMysqL-5.6.35-linux-glibc2.5-x86_64.tar.gz tarzxfPHP-5.6.30.tar.gz tarzxfNginx-1.12.1.tar.gz
软件安装
mvMysqL-5.6.35-linux-glibc2.5-x86_64/usr/local/MysqL cd../MysqL/ useraddMysqL mkdir/data/ yuminstall-yperlperl-Data-Dumperlibaiolibaio-devel ./scripts/MysqL_install_db--user=MysqL--datadir=/data/MysqL cpsupport-files/my-default.cnf/etc/my.cnf cpsupport-files/MysqL.server/etc/init.d/MysqLd vi/etc/init.d/MysqLd basedir=/usr/local/MysqL datadir=/data/MysqL chkconfig--addMysqLd serviceMysqLdstart
useradd-s/sbin/nologinPHP-fpm cd/usr/local/src/PHP-5.6.30 wgethttp://vault.centos.org/5.7/os/x86_64/CentOS/kernel-headers-2.6.18-274.el5.x86_64.rpm rpm-ivhkernel-headers-2.6.18-274.el5.x86_64.rpm yuminstall-ygcclibxml2-developenssl-develbzip2-devellibjpeg-turbo-devellibpng-develfreetype-devellibmcrypt-devellibcurl-devel ./configure--prefix=/usr/local/PHP-fpm--with-config-file-path=/usr/local/PHP-fpm/etc--enable-fpm--with-fpm-user=PHP-fpm--with-fpm-group=PHP-fpm--with-MysqL=/usr/local/MysqL--with-MysqLi=/usr/local/MysqL/bin/MysqL_config--with-pdo-MysqL=/usr/local/MysqL--with-MysqL-sock=/tmp/MysqL.sock--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir--with-mcrypt--enable-soap--enable-gd-native-ttf--enable-ftp--enable-mbstring--enable-exif--with-pear--with-curl--with-openssl make&&makeinstall cpPHP.ini-production/usr/local/PHP-fpm/etc/PHP.ini cp/usr/local/src/PHP-5.6.30/sapi/fpm/init.d.PHP-fpm/etc/init.d/PHP-fpm vi/usr/local/PHP-fpm/etc/PHP-fpm.conf [global] pid=/usr/local/PHP-fpm/var/run/PHP-fpm.pid error_log=/usr/local/PHP-fpm/var/log/PHP-fpm.log [www] listen=/tmp/PHP-fcgi.sock listen.mode=666 user=PHP-fpm group=PHP-fpm pm=dynamic pm.max_children=50 pm.start_servers=20 pm.min_spare_servers=5 pm.max_spare_servers=35 pm.max_requests=500 rlimit_files=1024 chmod755/etc/init.d/PHP-fpm chkconfig--addPHP-fpm chkconfigPHP-fpmon servicePHP-fpmstart
cd/usr/local/src/Nginx-1.12.1 ./configure--prefix=/usr/local/Nginx make&&makeinstall vi/etc/init.d/Nginx #!/bin/bash #chkconfig:-3021 #description:httpservice. #SourceFunctionLibrary ./etc/init.d/functions #NginxSettings Nginx_SBIN="/usr/local/Nginx/sbin/Nginx" Nginx_CONF="/usr/local/Nginx/conf/Nginx.conf" Nginx_PID="/usr/local/Nginx/logs/Nginx.pid" RETVAL=0 prog="Nginx" start() { echo-n$"Starting$prog:" mkdir-p/dev/shm/Nginx_temp daemon$Nginx_SBIN-c$Nginx_CONF RETVAL=$? echo return$RETVAL } stop() { echo-n$"Stopping$prog:" killproc-p$Nginx_PID$Nginx_SBIN-TERM rm-rf/dev/shm/Nginx_temp RETVAL=$? echo return$RETVAL } reload() { echo-n$"Reloading$prog:" killproc-p$Nginx_PID$Nginx_SBIN-HUP RETVAL=$? echo return$RETVAL } restart() { stop start } configtest() { $Nginx_SBIN-c$Nginx_CONF-t return0 } case"$1"in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; configtest) configtest ;; *) echo$"Usage:$0{start|stop|reload|restart|configtest}" RETVAL=1 esac exit$RETVAL chmod755/etc/init.d/Nginx chkconfig--addNginx chkconfigNginxon cd/usr/local/Nginx/conf/;mvNginx.confNginx.conf.bak viNginx.conf usernobodynobody; worker_processes2; error_log/usr/local/Nginx/logs/Nginx_error.logcrit; pid/usr/local/Nginx/logs/Nginx.pid; worker_rlimit_nofile51200; events { useepoll; worker_connections6000; } http { includemime.types; default_typeapplication/octet-stream; server_names_hash_bucket_size3526; server_names_hash_max_size4096; log_formatcombined_realip'$remote_addr$http_x_forwarded_for[$time_local]' '$host"$request_uri"$status' '"$http_referer""$http_user_agent"'; sendfileon; tcp_nopushon; keepalive_timeout30; client_header_timeout3m; client_body_timeout3m; send_timeout3m; connection_pool_size256; client_header_buffer_size1k; large_client_header_buffers84k; request_pool_size4k; output_buffers432k; postpone_output1460; client_max_body_size10m; client_body_buffer_size256k; client_body_temp_path/usr/local/Nginx/client_body_temp; proxy_temp_path/usr/local/Nginx/proxy_temp; fastcgi_temp_path/usr/local/Nginx/fastcgi_temp; fastcgi_intercept_errorson; tcp_nodelayon; gzipon; gzip_min_length1k; gzip_buffers48k; gzip_comp_level5; gzip_http_version1.1; gzip_typestext/plainapplication/x-javascripttext/csstext/htm application/xml; server { listen80; server_namelocalhost; indexindex.htmlindex.htmindex.PHP; root/usr/local/Nginx/html; location~\.PHP$ { includefastcgi_params; fastcgi_passunix:/tmp/PHP-fcgi.sock; fastcgi_indexindex.PHP; fastcgi_paramSCRIPT_FILENAME/usr/local/Nginx/html$fastcgi_script_name; } } } /etc/init.d/Nginxstart
效果测试
vi/usr/local/Nginx/html/1.PHP <?PHP echo"test"; ?>原文链接:https://www.f2er.com/centos/376250.html