59 lines
1.7 KiB
Bash
Executable File
59 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. ./myserver.conf
|
|
. ./utils.sh
|
|
|
|
install_nginx_package()
|
|
{
|
|
pkg_add nginx-1.22.0p0 nginx-headers-more-1.22.0 nginx-stream-1.22.0
|
|
}
|
|
|
|
gen_nginx_configuration()
|
|
{
|
|
cp -v default_configuration/nginx/nginx.conf.example my_configuration/nginx/nginx.conf
|
|
openssl dhparam -out my_configuration/nginx/dhparam.pem 2048
|
|
|
|
}
|
|
|
|
|
|
|
|
make_default_homepage()
|
|
{
|
|
cp -v default_configuration/nginx/site-avalaible/example \
|
|
my_configuration/nginx/site-available/$DOMAIN
|
|
sed -i "s/__DOMAIN__/$DOMAIN/g" my_configuration/nginx/site-available/$DOMAIN
|
|
}
|
|
|
|
install_nginx_configuration(){
|
|
mkdir -v /etc/nginx/sites-enabled/
|
|
mkdir -v /etc/nginx/sites-available/
|
|
mkdir -v /etc/nginx/snippets/
|
|
cp -v my_configuration/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
cp -v my_configuration/nginx/dhparam.pem /etc/nginx/dhparam.pem
|
|
cp -v my_configuration/nginx/snippets/* /etc/nginx/snippets/
|
|
}
|
|
|
|
install_chroot_env()
|
|
{
|
|
mkdir /var/www/etc/ssl/
|
|
install -m 444 -o root -g bin /etc/resolv.conf /var/www/etc/
|
|
install -m 444 -o root -g bin /etc/ssl/cert.pem /etc/ssl/openssl.cnf /var/www/etc/ssl/
|
|
}
|
|
|
|
add_logs_to_newssyslog(){
|
|
cp -v /etc/newsyslog.conf /etc/newsyslog.conf.old
|
|
egrep -v "nginx|httpd" /etc/newsyslog.conf > /tmp/newsyslog.conf
|
|
cat >> /tmp/newsyslog.conf <<EOF
|
|
/var/www/logs/access.log 644 2 * \$W0 Z /var/www/run/nginx.pid SIGUSR1
|
|
/var/www/logs/error.log 644 2 250 * Z /var/www/run/nginx.pid SIGUSR1
|
|
EOF
|
|
mv /tmp/newsyslog.conf /etc/newsyslog.conf
|
|
}
|
|
|
|
mkdir my_configuration/nginx/
|
|
#install_nginx_package
|
|
gen_nginx_configuration
|
|
#install_chroot_env
|
|
#install_nginx_configuration
|
|
#restart_webserver_service
|