Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
parf committed Mar 14, 2018
0 parents commit 115a101
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Composer Files
vendor
*.log
var
old
legacy
*.old
# zend studio
.buildpath
.project
.settings
*.swp
# local files never commited to git
*.local
*.local.*
# phpStrom
/.idea/
.sass-cache
node_modules
tmp
2 changes: 2 additions & 0 deletions bin/admin/route-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# windows CMD
# route add 192.168.3.0/24 192.168.0.118
18 changes: 18 additions & 0 deletions bin/admin/run-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# PRJ - one-word project name
PRJ=bus
# project source code
PROJ=$HOME/src/$PRJ
HOST=$PRJ.com
# change to PUBLIC IP, check your OS instruction how to add additional IPs to system
IP=192.168.3.1

#DT=`date +%d-%b-%y`
DT=`date +%b-%y`
RUN="sudo docker run --log-driver=journald -h $HOST -v '$PROJ:/proj' -v '$HOME/docker-home:/home/dev' -p $IP:1022:22 -p $IP:80:80 -p $IP:443:443 -p $IP:9001:9001 --name=$PRJ-$DT parf/centos7-php72-dvp"
echo ABOUT TO RUN
echo $RUN
echo ^C to stop
read
eval $RUN
36 changes: 36 additions & 0 deletions etc/nginx/conf.d/hb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
server {
listen 80;
server_name hb.ws;

set $SITE "hb";
set $ROOT "/proj/$SITE";
root "$ROOT/www";

# nginx behind nginx
if ($http_x_host = "") {
set $http_x_host $host;
}

location /tmp/ {
autoindex on;
}

location /js/ { access_log off; expires 60d; }
location /img/ { access_log off; expires 60d; }
location /css/ { access_log off; expires 60d; }
location /fonts/ { access_log off; expires 60d; }

location / {
proxy_buffering off;
# no google (robots.txt)
rewrite ^/ng/(.*)$ /$1;

include fastcgi_params;
fastcgi_pass unix:/run/php5-fpm.sock;
# fastcgi_pass fpm;
fastcgi_index index.php;
# fastcgi_param PHP_VALUE "auto_prepend_file=$ROOT/init.php";
fastcgi_param SCRIPT_FILENAME $ROOT/init.php;
}

}
93 changes: 93 additions & 0 deletions etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# For more information on configuration, see:
# * Official English Documentation: https://nginx.org/en/docs/
# * Official Russian Documentation: https://nginx.org/ru/docs/

user nginx dev-web;
worker_processes 1;

#error_log /var/log/nginx/error.log notice;
error_log /var/log/nginx/error.log info;

pid /run/nginx.pid;
worker_rlimit_nofile 10000;

events {
worker_connections 8096;
multi_accept on;
use epoll;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$host" "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
log_format main '[$time_local] "$host" $remote_addr "$request" $status $body_bytes_sent $request_time';

types_hash_max_size 4096;
client_body_buffer_size 4m;

access_log /var/log/nginx/access.log main;

keepalive_timeout 70 20;
keepalive_requests 10000;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
reset_timedout_connection on;
send_timeout 15;

gzip on;
#gzip_http_version 1.0;
gzip_buffers 128 32k;
gzip_min_length 1024;
gzip_comp_level 1;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/json;

# set correct remote ip
real_ip_header X-Real-IP;
# set_real_ip_from IP/MASK;

# upstream keep alive setting require http 1.1
proxy_http_version 1.1;
proxy_set_header Connection "";

proxy_connect_timeout 30s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
fastcgi_connect_timeout 300s;
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-uri $request_uri;

geo $admin {
default 0;

}

proxy_set_header X-Admin $admin;

#upstream fpm { server 127.0.0.1:9000; keepalive 32; }
upstream fpm { server unix:/var/run/php5-fpm.sock; keepalive 50; }

# Default server
server { return 404; }

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See https://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

server {
listen 80 default_server;
#listen 443 default_server;
server_name _unknown;
return 403;
}

}
50 changes: 50 additions & 0 deletions etc/php-fpm/dvp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[www]
;listen = 9000
listen = /var/run/php5-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660

user = web
group = dev-web
;listen.backlog = -1
; listen.allowed_clients = 127.0.0.1,192.168.1.11,192.168.11.160

; pm = dynamic
pm = static

pm.max_children = 15
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 15

pm.max_requests = 10000
pm.status_path = /fpm-status

;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
php_admin_value[error_log] = syslog
php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

;ping.path = /ping
;ping.response = pong
request_terminate_timeout = 30s
request_slowlog_timeout = 5
slowlog = /var/log/php-fpm.slow.log
rlimit_files = 131072
rlimit_core = unlimited
;chroot =
;chdir = /var/www
;catch_workers_output = yes


[global]
pid = /var/run/php-fpm/php-fpm-bus.pid
error_log = syslog
;log_level = notice
;emergency_restart_threshold = 0
;emergency_restart_interval = 0
process_control_timeout = 30s
;daemonize = yes

4 changes: 4 additions & 0 deletions hb/init.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

phpinfo();

0 comments on commit 115a101

Please sign in to comment.