-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
3,114 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
version: '3' | ||
# 定义四个服务nginx,php,mysql,redis | ||
services: | ||
nginx: | ||
# 依赖php服务,意味着在启动nginx之前先启动php | ||
depends_on: | ||
- php | ||
# nginx镜像的路径 | ||
build: ./nginx | ||
volumes: | ||
- ./nginx/www:/usr/share/nginx/html | ||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf | ||
- ./nginx/conf.d:/etc/nginx/conf.d | ||
- ./nginx/ssl/:/etc/nginx/ssl/ | ||
- ./nginx/log/error.log:/var/log/nginx/error.log | ||
# nginx意外退出时自动重启 | ||
restart: always | ||
|
||
# 映射80和443端口 | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
networks: | ||
- frontend | ||
|
||
# 容器名称 | ||
container_name: nginx | ||
|
||
php: | ||
depends_on: | ||
- mysql | ||
- redis | ||
build: ./php | ||
ports: | ||
- "9000" | ||
networks: | ||
- frontend | ||
- backend | ||
volumes: | ||
- ./php/php-fpm.conf:/usr/local/php/etc/php-fpm.conf | ||
- ./php/www.conf:/usr/local/php/etc/php-fpm.d/www.conf | ||
- ./php/php.ini:/usr/local/php/etc/php.ini | ||
- ./php/log/php-fpm.log:/usr/local/php/var/log/php-fpm.log | ||
- ./nginx/www:/usr/share/nginx/html | ||
restart: always | ||
container_name: php | ||
|
||
# MySQL | ||
mysql: | ||
image: hub.c.163.com/library/mysql:latest | ||
ports: | ||
- "127.0.0.1:3306:3306" | ||
volumes: | ||
- ./mysql/data:/var/lib/mysql | ||
- ./mysql/my.cnf:/etc/my.cnf | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 123456 | ||
networks: | ||
- backend | ||
restart: always | ||
container_name: mysql | ||
|
||
# REDIS | ||
redis: | ||
build: ./redis | ||
ports: | ||
- "127.0.0.1:6379:6379" | ||
networks: | ||
- backend | ||
volumes: | ||
- ./redis/redis.conf:/usr/local/redis/redis.conf | ||
- ./redis/redis.log:/usr/local/redis/redis.log | ||
restart: always | ||
container_name: redis | ||
|
||
networks: | ||
frontend: | ||
backend: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# For advice on how to change settings please see | ||
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html | ||
|
||
[mysqld] | ||
# | ||
# Remove leading # and set to the amount of RAM for the most important data | ||
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. | ||
# innodb_buffer_pool_size = 128M | ||
# | ||
# Remove leading # to turn on a very important data integrity option: logging | ||
# changes to the binary log between backups. | ||
# log_bin | ||
# | ||
# Remove leading # to set options mainly useful for reporting servers. | ||
# The server defaults are faster for transactions and fast SELECTs. | ||
# Adjust sizes as needed, experiment to find the optimal values. | ||
# join_buffer_size = 128M | ||
# sort_buffer_size = 2M | ||
# read_rnd_buffer_size = 2M | ||
datadir=/var/lib/mysql | ||
socket=/var/lib/mysql/mysql.sock | ||
|
||
# Disabling symbolic-links is recommended to prevent assorted security risks | ||
symbolic-links=0 | ||
|
||
# Recommended in standard MySQL setup | ||
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES | ||
default-storage-engine=INNODB | ||
|
||
character-set-server=utf8 | ||
|
||
collation-server=utf8_general_ci | ||
|
||
|
||
[mysqld_safe] | ||
log-error=/var/log/mysqld.log | ||
pid-file=/var/run/mysqld/mysqld.pid | ||
|
||
[client] | ||
|
||
default-character-set=utf8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# 拉取 CentOS | ||
FROM hub.c.163.com/library/centos:latest | ||
|
||
# 维护者 | ||
MAINTAINER voocel <voocel@gmail.com> | ||
|
||
# 设置 openssl 和 nginx 版本 | ||
ENV NGINX_VERSION 1.17.2 | ||
|
||
# 安装依赖 | ||
RUN set -x \ | ||
&& yum update -y \ | ||
&& yum install -y wget gcc gcc-c++ make automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel perl file tar bzip2-devel bzip2 openssl openssl-devel zlib zlib-devel \ | ||
|
||
# 创建下载目录 | ||
&& mkdir ~/download \ | ||
|
||
# 下载 openssl | ||
&& cd ~/download \ | ||
|
||
# 下载 nginx | ||
&& wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \ | ||
&& tar -zxvf nginx-$NGINX_VERSION.tar.gz \ | ||
&& cd nginx-$NGINX_VERSION \ | ||
&& mkdir -p /var/cache/nginx \ | ||
&& groupadd nginx \ | ||
&& useradd -r -g nginx nginx \ | ||
&& ./configure \ | ||
--prefix=/usr/local/nginx \ | ||
--conf-path=/etc/nginx/nginx.conf \ | ||
--sbin-path=/usr/sbin/nginx \ | ||
--error-log-path=/var/log/nginx/error.log \ | ||
--http-log-path=/var/log/nginx/access.log \ | ||
--pid-path=/var/run/nginx.pid \ | ||
--lock-path=/var/run/nginx.lock \ | ||
--http-client-body-temp-path=/var/cache/nginx/client_temp \ | ||
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \ | ||
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ | ||
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ | ||
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \ | ||
--user=nginx \ | ||
--group=nginx \ | ||
--with-pcre \ | ||
--with-http_v2_module \ | ||
--with-http_ssl_module \ | ||
--with-http_realip_module \ | ||
--with-http_addition_module \ | ||
--with-http_sub_module \ | ||
--with-http_dav_module \ | ||
--with-http_flv_module \ | ||
--with-http_mp4_module \ | ||
--with-http_gunzip_module \ | ||
--with-http_gzip_static_module \ | ||
--with-http_random_index_module \ | ||
--with-http_secure_link_module \ | ||
--with-http_stub_status_module \ | ||
--with-http_auth_request_module \ | ||
--with-mail \ | ||
--with-mail_ssl_module \ | ||
--with-file-aio \ | ||
--with-http_v2_module \ | ||
--with-threads \ | ||
--with-stream \ | ||
--with-stream_ssl_module \ | ||
&& make \ | ||
&& make install \ | ||
&& rm -rf ~/download \ | ||
&& yum clean all | ||
|
||
# 若要使用https,请将以下三个注释去掉,并在ssl文件夹中添加你自己申请的两个证书文件 | ||
# && mkdir -p /etc/nginx/cert | ||
#COPY ssl/nginx.pem /etc/nginx/cert/nginx.pem | ||
#COPY ssl/nginx.key /etc/nginx/cert/nginx.key | ||
|
||
CMD ["/usr/sbin/nginx","-g","daemon off;"] | ||
|
||
EXPOSE 80 443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
# 全站使用https则开启下面这个注释 | ||
# rewrite ^ https://$http_host$request_uri? permanent; | ||
|
||
#charset koi8-r; | ||
|
||
#access_log logs/host.access.log main; | ||
root /usr/share/nginx/html; | ||
location / { | ||
|
||
index index.html index.htm index.php; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root html; | ||
} | ||
|
||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | ||
# | ||
#location ~ \.php$ { | ||
# proxy_pass http://127.0.0.1; | ||
#} | ||
|
||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
# | ||
location ~ \.php$ { | ||
|
||
fastcgi_pass php:9000; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
# deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
# | ||
#location ~ /\.ht { | ||
# deny all; | ||
#} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
upstream frps{ | ||
server 10.163.56.122:8080; | ||
keepalive 64; | ||
} | ||
|
||
server { | ||
listen 80; | ||
server_name *.yahui.wang; | ||
# access_log /data/logs/frpc.proxy.log; | ||
location / { | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Nginx-Proxy true; | ||
proxy_set_header Connection ""; | ||
proxy_pass http://frps; | ||
client_max_body_size 1000m; | ||
|
||
} | ||
|
||
} |
Empty file.
Oops, something went wrong.