{"id":32674,"date":"2022-12-15T20:43:22","date_gmt":"2023-04-06T13:30:14","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/"},"modified":"2024-04-29T05:28:12","modified_gmt":"2024-04-28T21:28:12","slug":"%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/","title":{"rendered":"\u4f7f\u7528Docker\u8fd0\u884cnginx"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u4f7f\u7528Docker\uff0c\u5728CentOS 7\u4e0a\u8fd0\u884c\u5e76\u5b89\u88c5Nginx\u3002<br \/>\n\u7136\u540e\uff0c\u76f4\u5230\u5728\u6d4f\u89c8\u5668\u4e0a\u663e\u793a\u3002<\/p>\n<h1>\u73af\u5883<\/h1>\n<p>\u6211\u5df2\u7ecf\u5b89\u88c5\u4e86Docker\u3002<br \/>\n\u6211\u5728fodera\u4e0a\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u5bf9&#8221;cat \/etc\/redhat-release&#8221;\u7684\u4e2d\u6587\u672c\u5730\u5316\u91ca\u4e49\uff1a<br \/>\n-&gt;Fedora 24\u7248\u672c (Twenty Four)<\/p>\n<h1>Dockerfile\uff08\u7528\u4e8e\u521b\u5efaDocker\u5bb9\u5668\u7684\u6587\u4ef6\uff09<\/h1>\n<pre class=\"post-pre\"><code>FROM centos:7\r\nRUN yum -y update &amp;&amp; \\\r\n\r\n   #nginx\u30ea\u30dd\u30b8\u30c8\u30ea\u8ffd\u52a0\r\n   rpm -ivh http:\/\/nginx.org\/packages\/centos\/7\/noarch\/RPMS\/nginx-release-centos-7-0.el7.ngx.noarch.rpm &amp;&amp; \\\r\n   #nginx\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\n   yum install nginx -y \r\n\r\n\r\nEXPOSE 80\r\nCMD [\"\/usr\/sbin\/nginx\", \"-g\", \"daemon off;\"]\r\n<\/code><\/pre>\n<p>\u6211\u624d\u521a\u77e5\u9053\u5982\u679c\u4e0d\u5728\u524d\u53f0\u8fd0\u884c\uff0c\u5e94\u7528\u7a0b\u5e8f\u4f1a\u7acb\u5373\u505c\u6b62\u3002<\/p>\n<p>\u5efa\u7acb\u548c\u8fd0\u884c<\/p>\n<pre class=\"post-pre\"><code>docker build -t a .\/\r\ndocker run -d -p 8000:80 --name ab a \r\n<\/code><\/pre>\n<h1>\u7528\u6d4f\u89c8\u5668\u663e\u793a<\/h1>\n<p>\u597d\u7684\uff01<\/p>\n<h1>\u4e0b\u6b21<\/h1>\n<p>\u6211\u6253\u7b97\u4f7f\u7528php-fpm\u5bb9\u5668\uff01<\/p>\n<h1>\u7ed9\u4f60\u4e00\u4e2a\u989d\u5916\u7684\u63d0\u793a<\/h1>\n<p>\u5220\u9664\u5bb9\u5668\u3001<br \/>\n\u5220\u9664\u955c\u50cf\u3001<br \/>\n\u5bb9\u5668\u7684shell\u3001<br \/>\nnginx\u7684\u7248\u672c<\/p>\n<pre class=\"post-pre\"><code>docker rm ab -f\r\ndocker rmi a\r\ndocker exec -it ab \/bin\/bash\r\nnginx -v\r\n<\/code><\/pre>\n<h1>\u8bf7\u7528\u4e2d\u6587\u8fdb\u884c\u539f\u751f\u6539\u5199\uff0c\u53ea\u9700\u8981\u4e00\u4e2a\u9009\u9879\uff1a<\/h1>\n<p>\u53c2\u8003\uff1a<\/p>\n<p>\u4f7f\u7528Docker\u521b\u5efa\u5f00\u53d1\u73af\u5883\u3010nginx\u5bb9\u5668\u7bc7\u3011<br \/>\n\u5728Mac\u4e0a\u4f7f\u7528Docker\uff0c\u7b2c\u4e8c\u90e8\u5206<br \/>\n3\u4e2a\u5173\u4e8e\u5728Docker\u4e0a\u8fd0\u884cnginx\u7684\u5c0f\u8d34\u58eb\u9009\u9879<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u4f7f\u7528Docker\uff0c\u5728CentOS 7\u4e0a\u8fd0\u884c\u5e76\u5b89\u88c5Nginx\u3002 \u7136\u540e\uff0c\u76f4\u5230\u5728\u6d4f\u89c8\u5668\u4e0a\u663e\u793a\u3002 \u73af\u5883 \u6211\u5df2\u7ecf\u5b89 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-32674","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528Docker\u8fd0\u884cnginx - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528docker\u8fd0\u884cnginx\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528Docker\u8fd0\u884cnginx\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u4f7f\u7528Docker\uff0c\u5728CentOS 7\u4e0a\u8fd0\u884c\u5e76\u5b89\u88c5Nginx\u3002 \u7136\u540e\uff0c\u76f4\u5230\u5728\u6d4f\u89c8\u5668\u4e0a\u663e\u793a\u3002 \u73af\u5883 \u6211\u5df2\u7ecf\u5b89 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528docker\u8fd0\u884cnginx\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-06T13:30:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-28T21:28:12+00:00\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/\",\"name\":\"\u4f7f\u7528Docker\u8fd0\u884cnginx - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-04-06T13:30:14+00:00\",\"dateModified\":\"2024-04-28T21:28:12+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528Docker\u8fd0\u884cnginx\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528Docker\u8fd0\u884cnginx - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528docker\u8fd0\u884cnginx\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528Docker\u8fd0\u884cnginx","og_description":"\u9996\u5148 \u4f7f\u7528Docker\uff0c\u5728CentOS 7\u4e0a\u8fd0\u884c\u5e76\u5b89\u88c5Nginx\u3002 \u7136\u540e\uff0c\u76f4\u5230\u5728\u6d4f\u89c8\u5668\u4e0a\u663e\u793a\u3002 \u73af\u5883 \u6211\u5df2\u7ecf\u5b89 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528docker\u8fd0\u884cnginx\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-04-06T13:30:14+00:00","article_modified_time":"2024-04-28T21:28:12+00:00","author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/","name":"\u4f7f\u7528Docker\u8fd0\u884cnginx - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-04-06T13:30:14+00:00","dateModified":"2024-04-28T21:28:12+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528Docker\u8fd0\u884cnginx"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8docker%e8%bf%90%e8%a1%8cnginx\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/32674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=32674"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/32674\/revisions"}],"predecessor-version":[{"id":83325,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/32674\/revisions\/83325"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=32674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=32674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=32674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}