秀米云香港服务器

编写nginx启动剧本,香港服务器香港服务器租用,并插手系统处事#vim/etc/init.d/nginx//编写nginx启动剧本,插手系统处事。写入以下内容#!/bin/bash#chkconfig:-3021#description:httpservice.#SourceFunctionLibrary./etc/init.d/functions#NginxSettingsNGINX_SBIN="/usr/local/nginx/sbin/nginx"NGINX_CONF="/usr/local/nginx/conf/nginx.conf"NGINX_PID="/usr/local/nginx/logs/nginx.pid"RETVAL=0prog="Nginx"start(){echo-n$"Starting$prog:"mkdir-p/dev/shm/nginx_tempdaemon$NGINX_SBIN-c$NGINX_CONFRETVAL=$?echoreturn$RETVAL}stop(){echo-n$"Stopping$prog:"killproc-p$NGINX_PID$NGINX_SBIN-TERMrm-rf/dev/shm/nginx_tempRETVAL=$?echoreturn$RETVAL}reload(){echo-n$"Reloading$prog:"killproc-p$NGINX_PID$NGINX_SBIN-HUPRETVAL=$?echoreturn$RETVAL}restart(){stopstart}configtest(){$NGINX_SBIN-c$NGINX_CONF-treturn0}case"$1"instart)start;;stop)stop;;reload)reload;;restart)restart;;configtest)configtest;;*)echo$"Usage:$0{start|stop|reload|restart|configtest}"RETVAL=1esacexit$RETVAL#chmod755/etc/init.d/nginx//生存后修改权限#chkconfig--addnginx//启动nginx#chkconfignginxon//执行后开机启动变动nginx设置#>/usr/local/nginx/conf/nginx.conf//首先把本来设置文件清空#vim/usr/local/nginx/conf/nginx.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/htmapplication/xml;include/usr/local/nginx/conf/vhosts/*.conf;}#/usr/local/nginx/sbin/nginx–t//检测设置是否正确#servicenginxrestart//重启nginx#mkdir/usr/local/nginx/conf/vhosts#cd!$//进入上面输入的目次#vimdefault.conf//插手如下设置server{listen80default_server;server_namewww.111.com;indexindex.htmlindex.htmindex.php;root/tmp/tmp;denyall;}#vimtest.conf//插手如下设置server{listen80;server_namewww.test.com;indexindex.htmlindex.htmindex.php;root/data/www;location~.php${includefastcgi_params;fastcgi_passunix:/tmp/php-fcgi.sock;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME/data/www$fastcgi_script_name;}}#/etc/init.d/nginxreload//从头加载,并未重启处事

标题:nginx启动剧本以及设置文件内容

地址: https://www.yunhk.xyz/25801.html