Skip to content

Commit

Permalink
增加mysql和nginx的rewrite配置
Browse files Browse the repository at this point in the history
  • Loading branch information
Dcmuyi committed Aug 21, 2017
1 parent 126ffcc commit 1f779ae
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 178 deletions.
345 changes: 215 additions & 130 deletions .idea/workspace.xml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions conf/mysql/mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysql]
62 changes: 31 additions & 31 deletions conf/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
upstream phpFpm
{
server fpm1:9000;
server fpm2:9000;
}
upstream phpFpm {
server fpm1:9000;
server fpm2:9000;
}

server {
listen 443;
Expand All @@ -18,21 +17,22 @@ server {
index index.php index.html index.htm;
client_max_body_size 1000m;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}

location ~ \.php$ {
#root html;
#root html;
fastcgi_pass phpFpm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

error_page 404 /404.html;
location = /var/www/html/40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /var/www/html/50x.html {
}
fastcgi_index index.php;
try_files $uri $uri/ /index.php?$args;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}

server {
Expand All @@ -45,24 +45,24 @@ server {
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
root /var/www/html/site2;
root /var/www/html/muyi/frontend/web;
index index.php index.html index.htm;
client_max_body_size 1000m;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}

location ~ \.php$ {
#root html;
#root html;
fastcgi_pass phpFpm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

error_page 404 /404.html;
location = /var/www/html/40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /var/www/html/50x.html {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}

Expand Down
34 changes: 17 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ services:
- ./conf/nginx/conf.d:/etc/nginx/conf.d/:ro
- ./conf/nginx/cert/:/etc/nginx/cert/:rw
- ./log/nginx/:/var/log/nginx/:rw
networks:
- frontend
- backend
links:
- php-fpm1:fpm1
- php-fpm2:fpm2
php-fpm1:
image: "${DOCKER_USER}/php-fpm1:v1"
image: "${DOCKER_USER}/php-fpm:v1"
build:
context: .
dockerfile: Dockerfile.php
Expand All @@ -31,11 +28,10 @@ services:
- ./conf/php/php.ini:/usr/local/etc/php/php.ini:ro
- ./conf/php/php-fpm.d/site.conf:/usr/local/etc/php-fpm.d/site.conf:rw
- ./log/php-fpm/:/var/log/php-fpm/:rw
networks:
- frontend
- backend
links:
- mysql:mysql
php-fpm2:
image: "${DOCKER_USER}/php-fpm2:v1"
image: "${DOCKER_USER}/php-fpm:v1"
build:
context: .
dockerfile: Dockerfile.php
Expand All @@ -48,12 +44,16 @@ services:
- ./conf/php/php.ini:/usr/local/etc/php/php.ini:ro
- ./conf/php/php-fpm.d/site.conf:/usr/local/etc/php-fpm.d/site.conf:rw
- ./log/php-fpm/:/var/log/php-fpm/:rw
networks:
- frontend
- backend
volumes:
mysql-data:

networks:
frontend:
backend:
links:
- mysql:mysql
mysql:
image: mysql:latest
ports:
- "3306:3306"
restart: unless-stopped
volumes:
- ./conf/mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf:ro
- ./mysql/:/var/lib/mysql/:rw
- ./log/mysql/:/var/log/mysql/:rw
environment:
MYSQL_ROOT_PASSWORD: "muyi123"
2 changes: 2 additions & 0 deletions log/mysql/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions mysql/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 1f779ae

Please sign in to comment.