set_nginx_vhost_nophp
set_nginx_vhost_nophp(){
clear
f_banner
echo -e "\e[34m---------------------------------------------------------------------------------------------------------\e[00m"
echo -e "\e[93m[+]\e[00m Setup Virtual Host for Nginx"
echo -e "\e[34m---------------------------------------------------------------------------------------------------------\e[00m"
echo -e "\e[93m[+]\e[00m Configure a Virtual Host"
echo " Type a Name to Identify the Virtual Host"
echo -n " (For Example: myserver.com) "; read vhost
touch /usr/local/nginx/conf/sites-available/$vhost
cd ../..
cat templates/nginxvhost_nophp >> /usr/local/nginx/conf/sites-available/$vhost
sed -i s/server.com/$vhost/g /usr/local/nginx/conf/sites-available/$vhost
ln -s /usr/local/nginx/conf/sites-available/$vhost /usr/local/nginx/conf/sites-enabled/$vhost
say_done
}
La función set_nginx_vhost_nophp realiza los mismos pasos que la función set_nginx_vhost a excepción que no configura el soporte para PHP. Hace uso de la plantilla que se encuentra en templates/nginxvhost_nophp:
server {
listen 80;
server_name server.com;
location / {
ModSecurityEnabled on;
ModSecurityConfig modsecurity.conf;
root html/server.com;
index index.php index.html index.htm;
}
location ~ .(gif|png|jpe?g)$ {
valid_referers none blocked server.com *.server.com;
if ($invalid_referer) {
return 403;
}
}
# deny scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
## Block download agenta
if ($http_user_agent ~* LWP::Simple|wget|libwww-perl) {
return 403;
}
## Block some nasty robots
if ($http_user_agent ~ (msnbot|Purebot|Baiduspider|Lipperhey|Mail.Ru|scrapbot) ) {
return 403;
}
## Deny referal spam
if ( $http_referer ~* (jewelry|viagra|nude|girl|nudit|casino|poker|porn|sex|teen|babes) ) {
return 403;
}
}