Hello guys,
For the last few day I have been trying to teach myself how to do shell scripting but I am not really successful. Could someone show me how I should run the following as part of a .sh script?
So far this is what I came up with:
Thank you all in advance.
Fred
For the last few day I have been trying to teach myself how to do shell scripting but I am not really successful. Could someone show me how I should run the following as part of a .sh script?
Code:
cd /usr/ports/www/nginx
make config
set [x] IPv6 protocol (default)
set [x] Enable HTTP module (default)
set [x] Enable http_cache module (default)
set [x] Enable http_gzip_static module
set [x] Enable http_rewrite module (default)
set [x] Enable http_ssl module (default)
set [x] Enable http_stub_status module (default)
make install clean; rehash
mkdir -p /etc/nginx/sites-enabled/
mkdir -p /etc/nginx/sites-enabled/
mkdir -p /var/customers/webs/
mkdir -p /var/customers/tmp
mkdir -p /var/customers/logs/
echo 'nginx_enable="YES"' >> /etc/rc.conf
vi /usr/local/etc/nginx/nginx.conf
------------------------------------- ****** -------------------------------------
### Nginx configuration file ###
daemon on;
user www www;
worker_processes 4;
error_log /var/log/nginx/nginx.log crit;
pid /var/run/nginx.pid;
events {
use kqueue;
worker_connections 64;
accept_mutex_delay 50ms;
}
http {
access_log /var/log/nginx/access.log;
include mime.types;
default_type application/octet-stream;
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Open File Cache
open_file_cache max=512 inactive=20m;
open_file_cache_valid 60s;
open_file_cache_errors on;
# FastCGI Cache
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_path /var/tmp/nginx levels=1:2 keys_zone=cache:10m inactive=20m max_size=12m;
fastcgi_temp_path /var/tmp/nginx 1 2;
fastcgi_cache cache;
fastcgi_cache_valid 200 20m;
fastcgi_cache_valid 301 302 304 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_use_stale error timeout invalid_header http_500;
# SSL
#ssl_client_certificate /path/to/example.pem;
#ssl_crl /path/to/example.crl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH;
ssl_prefer_server_ciphers on;
ssl_session_cache builtin:256 shared:SSL:64k;
ssl_session_timeout 20m;
# GZip
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_static on;
include /usr/local/etc/nginx/conf.d/*.conf;
}
------------------------------------- ****** -------------------------------------
/usr/local/etc/rc.d/nginx restart
So far this is what I came up with:
Code:
#!/bin/sh
#
#
# nginx.sh @ Version 0.10
echo "# install Nginx from port"
cd /usr/ports/www/nginx
make config
?? need help on how to select my options??
echo "# create nginx directory"
mkdir -p /etc/nginx/sites-enabled/
mkdir -p /etc/nginx/sites-enabled/
mkdir -p /var/customers/webs/
mkdir -p /var/customers/tmp
mkdir -p /var/customers/logs/
echo "# start Nginx at start up"
echo 'nginx_enable="YES"' >> /etc/rc.conf
cat << 'EOF' > /usr/local/etc/nginx/nginx.conf
### Nginx configuration file ###
daemon on;
user www www;
worker_processes 4;
error_log /var/log/nginx/nginx.log crit;
pid /var/run/nginx.pid;
events {
use kqueue;
worker_connections 64;
accept_mutex_delay 50ms;
}
http {
access_log /var/log/nginx/access.log;
include mime.types;
default_type application/octet-stream;
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Open File Cache
open_file_cache max=512 inactive=20m;
open_file_cache_valid 60s;
open_file_cache_errors on;
# FastCGI Cache
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_path /var/tmp/nginx levels=1:2 keys_zone=cache:10m inactive=20m max_size=12m;
fastcgi_temp_path /var/tmp/nginx 1 2;
fastcgi_cache cache;
fastcgi_cache_valid 200 20m;
fastcgi_cache_valid 301 302 304 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_use_stale error timeout invalid_header http_500;
# SSL
#ssl_client_certificate /path/to/example.pem;
#ssl_crl /path/to/example.crl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH;
ssl_prefer_server_ciphers on;
ssl_session_cache builtin:256 shared:SSL:64k;
ssl_session_timeout 20m;
# GZip
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_static on;
include /usr/local/etc/nginx/conf.d/*.conf;
}
EOF
echo "# restart Nginx for the change to take effect"
/usr/local/etc/rc.d/nginx restart
sleep 3
Then I have more code....
Thank you all in advance.
Fred