project:apache-nginx-config-generator
Различия
Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слеваПредыдущая версияСледующая версия | Предыдущая версия | ||
project:apache-nginx-config-generator [2010/02/19 11:42] – artur | project:apache-nginx-config-generator [2017/03/23 21:59] (текущий) – внешнее изменение 127.0.0.1 | ||
---|---|---|---|
Строка 14: | Строка 14: | ||
домен3.ru</ | домен3.ru</ | ||
+ | **conf.php** - Генератор конфигов на PHP: | ||
+ | <code php><? | ||
+ | $domains = explode(" | ||
+ | |||
+ | |||
+ | $tmpl_apache=' | ||
+ | < | ||
+ | ServerAdmin webmaster@localhost | ||
+ | |||
+ | ServerName _host_ | ||
+ | ServerAlias www._host_ | ||
+ | |||
+ | < | ||
+ | AssignUserId admin www-data | ||
+ | </ | ||
+ | |||
+ | DocumentRoot / | ||
+ | |||
+ | < | ||
+ | Options Indexes FollowSymLinks All MultiViews | ||
+ | AllowOverride All | ||
+ | </ | ||
+ | |||
+ | ErrorLog | ||
+ | |||
+ | </ | ||
+ | '; | ||
+ | |||
+ | |||
+ | $tmpl_nginx = ' | ||
+ | |||
+ | server { | ||
+ | listen 80; | ||
+ | server_name | ||
+ | |||
+ | location /block.png | ||
+ | { | ||
+ | gzip off; | ||
+ | default_type image/png; | ||
+ | root / | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | location ~* ^.+\.(swf|xml|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|ods|arj|htc|avi|mpg|mp3|mid)$ { | ||
+ | | ||
+ | if ($invalid_referer) | ||
+ | { | ||
+ | return 404; | ||
+ | #rewrite / | ||
+ | #rewrite ^(.*)$ /block.png break; | ||
+ | } | ||
+ | | ||
+ | root / | ||
+ | | ||
+ | } | ||
+ | location ~ \.flv$ { | ||
+ | root | ||
+ | flv; | ||
+ | } | ||
+ | |||
+ | |||
+ | location / { | ||
+ | proxy_pass | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_redirect | ||
+ | } | ||
+ | |||
+ | location ~ /\.htp { deny all; } | ||
+ | location ~ /\.hta { deny all; } | ||
+ | location ~ /\.svn { deny all; } | ||
+ | location / | ||
+ | } | ||
+ | |||
+ | '; | ||
+ | |||
+ | foreach($domains as $d) | ||
+ | { | ||
+ | if(strlen($d)> | ||
+ | { | ||
+ | $d = strtolower(trim($d)); | ||
+ | $path = "/ | ||
+ | if(!file_exists($path))mkdir($path, | ||
+ | |||
+ | |||
+ | $domain_aliases = " | ||
+ | $user=" | ||
+ | //## | ||
+ | $s = str_replace(" | ||
+ | $n = str_replace("## | ||
+ | $n = str_replace("## | ||
+ | $n = str_replace("## | ||
+ | |||
+ | //echo $s; | ||
+ | $app_conf.=$s; | ||
+ | $nginx_conf.=$n; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | echo file_put_contents(" | ||
+ | echo file_put_contents(" | ||
+ | echo " |
project/apache-nginx-config-generator.1266568936.txt.gz · Последнее изменение: 2017/03/23 21:57 (внешнее изменение)