bat 快捷创建 laradock 下 nginx 配置文件

bat 脚本

@echo off

set conf=D:\Developer\laradock\nginx\sites\%1.conf 设置变量,%1 为参数1
if exist %conf% ( 
    echo exist!
    exit 
)

echo server { >> %conf%
echo= >> %conf%
echo     listen 80; >> %conf%
echo     listen [::]:80; >> %conf%
echo= >> %conf%
echo     # For https >> %conf%
echo     # listen 443 ssl; >> %conf%
echo     # listen [::]:443 ssl ipv6only=on; >> %conf%
echo     # ssl_certificate /etc/nginx/ssl/default.crt; >> %conf%
echo     # ssl_certificate_key /etc/nginx/ssl/default.key; >> %conf%
echo= >> %conf%
echo     server_name %1.test; >> %conf%
echo     root /var/www/%1/public; >> %conf%
echo     index index.php index.html index.htm; >> %conf%
echo= >> %conf%
echo     location / { >> %conf%
echo          try_files $uri $uri/ /index.php$is_args$args; >> %conf%
echo     } >> %conf%
echo= >> %conf%
echo     location ~ \.php$ { >> %conf%
echo         try_files $uri /index.php =404; >> %conf%
echo         fastcgi_pass php-upstream; >> %conf%
echo         fastcgi_index index.php; >> %conf%
echo         fastcgi_buffers 16 16k; >> %conf%
echo         fastcgi_buffer_size 32k; >> %conf%
echo         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; >> %conf%
echo         #fixes timeouts >> %conf%
echo         fastcgi_read_timeout 600; >> %conf%
echo         include fastcgi_params; >> %conf%
echo     } >> %conf%
echo= >> %conf%
echo     location ~ /\.ht { >> %conf%
echo         deny all; >> %conf%
echo     } >> %conf%
echo= >> %conf%
echo     location /.well-known/acme-challenge/ { >> %conf%
echo         root /var/www/letsencrypt/; >> %conf%
echo         log_not_found off; >> %conf%
echo     } >> %conf%
echo= >> %conf%
echo     error_log /var/log/nginx/%1_error.log; >> %conf%
echo     access_log /var/log/nginx/%1_access.log; >> %conf%
echo } >> %conf%

exit

设置环境变量

可以在任意位置使用 cmd

> add-laradock-nginx xxx 生成 xxx.conf 配置文件
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值