- インストールのドッキングウィンドウ
参考https://www.runoob.com/docker/centos-docker-install.html
-必要なシステムツールをインストールします
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
-ソースソフトウェアの情報を追加します
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- yumのキャッシュを更新:
sudo yum makecache fast
-インストール-CEドッカー:
sudo yum -y install docker-ce
-スタートドッカーのバックグラウンドサービス
sudo systemctl start docker
-インストール・作曲ドッカー
curl -L curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
-実行する権限を実行する
chmod -R 755 /usr/local/bin/docker-compose
-ハロー世界のテストラン
docker run hello-world
- nginxのをインストールします。
https://www.runoob.com/docker/docker-install-nginx.html参考
プルnginxの鏡-
docker pull nginx
-新カタログ
mkdir -p ~/nginx/html ~/nginx/logs ~/nginx/conf ~/nginx/conf.d
-コンテナを作成します。
docker run -v /root/nginx/html:/usr/share/nginx/html -v /root/nginx/conf.d:/etc/nginx/conf.d -v /root/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -p 80:80 -p 8888:8888 --name nginx -d nginx
- PHP-FPM 7.2をインストールします。
参考https://www.runoob.com/docker/docker-install-php.html
-ディレクトリを作成し
ます。mkdir〜/ PHP / conf.dを
- nginxのは、プルをミラーリング
docker pull php:7.2-fpm
-コンテナを作成します。
docker run -v /root/nginx/html:/var/www/html -v /root/php:/usr/local/etc/php --name php-fpm -d php:7.2-fpm
- 〜nginxの/ confに/ nginx.confファイルを追加します。
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
client_max_body_size 50m;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
-
〜/ nginxの/ conf.d / www.confファイルを追加します。
#Carbonuni-PHPプロジェクトディレクトリ、独自のプロジェクト定義に従って
#fastcgi_pass FPM次のアドレスに応じてドッキングウィンドウ上で定義されているのphp-FPM FPMビューコンテナのIPアドレスを調べますserver { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html/Carbonuni-PHP; index index.php index.html index.htm; try_files $uri $uri/ /index.php?$query_string; } #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 /usr/share/nginx/html/Carbonuni-PHP; } # 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 { root /usr/share/nginx/html/Carbonuni-PHP; fastcgi_pass 172.17.0.5:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME /var/www/html/kod$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; #} } ```
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
-
nginxの変更]コンテナをリセット
docker restart nginx
-
インストールのRedis
コンテナPHP-FPMへ
docker exec -it php-fpm bash
curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/3.1.6.tar.gz
tar xfz /tmp/redis.tar.gz
rm -r /tmp/redis.tar.gz
mkdir -p /usr/src/php/ext
mv phpredis-3.1.6 /usr/src/php/ext/redis
docker-php-ext-install redis
- いくつかの拡張機能は、ドッキングウィンドウ-PHP-EXT-インストールマウントすることができます
そのようなmysqliのをインストールなど
docker-php-ext-install mysqli
- GDライブラリがインストール
docker-php-ext-install gd
ここでエラーになります
#ソース・ソフトウェアのアップデート
APT更新
#さまざまなライブラリをインストール
APTインストール-y libwebp-devののlibjpeg-devののlibpng-devの-devののlibfreetype6
#ソース抽出
ドッカー-PHP-ソースエキス
フォルダ#gdソース
CDは/ usr / src / PHP / extにします/ GD
#コンパイルする準備ができて
ドッキングウィンドウ-PHP-EXT-のconfigure GD --with-WEBP-DIRを=は/ usr /含める/ WEBP --with-JPEG-dirを=は/ usr /含める--with-PNG-dirを=は/ usr / --with-freetypeの-DIR = /含ま freetype2の/含まれUSR /を
ディレクトリを作成し
ます。mkdir /usr/local/etc/php/conf.d/
#コンパイラのインストール
ドッカー-PHP-EXT-インストールGD
#は、インストールの進捗状況確認
のphp -mを| GDはgrep
#リブートコンテナ
ドッキングウィンドウの再起動PHP
- 作曲を増やします
プル作曲は
docker pull composer
composer.jsonが含まれている必要がありXXX、このプロジェクトに入り、
docker run -it --name composer -v /root/nginx/html/XXX:/app --privileged=true composer composer install
- あなたは、クラウドサーバのIPアクセスを実行することができます