日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用Docker搭建WordPress博客(三)nginx镜像制作

發布時間:2025/3/20 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用Docker搭建WordPress博客(三)nginx镜像制作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.查看創建nginx鏡像所有文件
[root@localhost nginx]# ls
default.conf Dockerfile fastcgi_params run.sh
2.創建Dockerfile文件
[root@localhost nginx]# cat Dockerfile

#VERSION 0.0.1 FROM centos MAINTAINER wtf "wtf@data.com" RUN rpm -ivh http://mirrors.sohu.com/fedora-epel/epel-release-latest-7.noarch.rpm RUN yum -y install nginx php php-fpm php-cli php-common php-gd php-mbstring php-mcrypt php-mysql php-pdo php-devel php-imagick php-xmlrpc php-xml php-bcmath php-dba php-enchant ADD default.conf /etc/nginx/conf.d/default.conf ADD fastcgi_params /etc/nginx/fastcgi_params ADD run.sh /tmp/ RUN chmod +x /tmp/run.sh ENTRYPOINT ["./tmp/run.sh"] EXPOSE 80

3.創建Nginx的default.conf
server {
listen 80 default_server;
servername?;

location / {root /usr/share/nginx/html;index index.html index.htm; }error_page 404 /404.html; location = /404.html {root /usr/share/nginx/html; }# error_page 500 502 503 504 /50x.html; location = /50x.html {root /usr/share/nginx/html; } location ~ \.php$ {root html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;include fastcgi_params; }

}
4.創建fastcgi_params

[root@localhost nginx]# cat fastcgi_params fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name;

5.創建run.sh
[root@localhost nginx]# cat run.sh

#!/bin/sh /usr/sbin/php-fpm -D /usr/sbin/nginx -g "daemon off;"

6.創建nginx鏡像
docker build -f Dockerfile -t weibo_nginx:v1 .
說明:-f 指定文件 , -t 指定生成鏡像名稱 ,冒號后為版本號。
7.查看生成的鏡像






? ? ?本文轉自品鑒初心51CTO博客,原文鏈接:http://blog.51cto.com/wutengfei/2054434,如需轉載請自行聯系原作者



與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的使用Docker搭建WordPress博客(三)nginx镜像制作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。