Browse Source

Better Way to detect and change nginx.conf

old-stable
Mitesh Shah 12 years ago
parent
commit
cd976be275
  1. 23
      usr/local/sbin/easyengine

23
usr/local/sbin/easyengine

@ -114,17 +114,22 @@ COMMONNGINX()
# Personal Settings For Nginx
echo -e "\033[34m Updating Nginx Configuration Files... \e[0m"
# Change Nginx Worker Processes Connections And Gzip
sed -i "s/# gzip/gzip/" /etc/nginx/nginx.conf
sed -i "s/worker_connections.*/worker_connections 1024;/" /etc/nginx/nginx.conf
sed -i "s/worker_processes.*/worker_processes `cat /proc/cpuinfo | grep processor | wc -l`;/" /etc/nginx/nginx.conf
grep "Easy Engine" /etc/nginx/nginx.conf &> /dev/null
if [ $? -ne 0 ]
then
# Set Custome Headers Variables And Proxy Settings
sed -i "s/http {/http {\n\t##\n\t# Easy Engine Settings\n\t##\n\n\tadd_header X-Powered-By "EasyEngine";\n\tadd_header rt-Fastcgi-Cache \$upstream_cache_status;\n\n\t# Proxy Settings\n\t# set_real_ip_from\tproxy-server-ip;\n\t# real_ip_header\tX-Forwarded-For;\n\n\tfastcgi_read_timeout 300;\n\tclient_max_body_size 100m;/" /etc/nginx/nginx.conf
# Change Nginx Worker Processes Connections And Gzip
sed -i "s/# gzip/gzip/" /etc/nginx/nginx.conf
sed -i "s/worker_connections.*/worker_connections 1024;/" /etc/nginx/nginx.conf
sed -i "s/worker_processes.*/worker_processes `cat /proc/cpuinfo | grep processor | wc -l`;/" /etc/nginx/nginx.conf
# Set Custome Headers Variables And Proxy Settings
sed -i "s/http {/http {\n\t##\n\t# Easy Engine Settings\n\t##\n\n\tadd_header X-Powered-By "EasyEngine";\n\tadd_header rt-Fastcgi-Cache \$upstream_cache_status;\n\n\t# Proxy Settings\n\t# set_real_ip_from\tproxy-server-ip;\n\t# real_ip_header\tX-Forwarded-For;\n\n\tfastcgi_read_timeout 300;\n\tclient_max_body_size 100m;/" /etc/nginx/nginx.conf
# Set Custome Logs
sed -i "s/error_log.*/error_log \/var\/log\/nginx\/error.log;\n\n\tlog_format rt_cache '\$remote_addr - \$upstream_cache_status [\$time_local]'\n\t\t'\"\$request\" \$status \$body_bytes_sent'\n\t\t'\"\$http_referer\" \"\$http_user_agent\"';/" /etc/nginx/nginx.conf
fi
# Set Custome Logs
sed -i "s/error_log.*/error_log \/var\/log\/nginx\/error.log;\n\n\tlog_format rt_cache '\$remote_addr - \$upstream_cache_status [\$time_local]'\n\t\t'\"\$request\" \$status \$body_bytes_sent'\n\t\t'\"\$http_referer\" \"\$http_user_agent\"';/" /etc/nginx/nginx.conf
# Check Directory Exist
if [ ! -d /etc/nginx/conf.d ]
then

Loading…
Cancel
Save