﻿{"id":392,"date":"2023-10-20T11:46:41","date_gmt":"2023-10-20T03:46:41","guid":{"rendered":"https:\/\/blog.yyspark.com\/?p=392"},"modified":"2023-10-20T12:40:23","modified_gmt":"2023-10-20T04:40:23","slug":"%e5%9c%a8%e7%be%a4%e6%99%96docker%e9%87%8c%e5%ae%89%e8%a3%85centos%e5%b9%b6%e5%ae%89%e8%a3%85nginx%e3%80%81ssh","status":"publish","type":"post","link":"https:\/\/airlive.online\/index.php\/2023\/10\/20\/%e5%9c%a8%e7%be%a4%e6%99%96docker%e9%87%8c%e5%ae%89%e8%a3%85centos%e5%b9%b6%e5%ae%89%e8%a3%85nginx%e3%80%81ssh\/","title":{"rendered":"\u5728\u7fa4\u6656Docker\u91cc\u5b89\u88c5centos\u5e76\u5b89\u88c5nginx\u3001ssh"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5148SSH\u5230DSM\nsudo -i\n\u8f93\u5165\u5bc6\u7801\u5207\u6362\u5230root\n\u5728\u5df2\u7ecf\u5b89\u88c5\u597ddocker\u7684\u60c5\u51b5\u4e0b\u8f93\u5165\n<strong>docker run -itd -p 9999:999 --name centos-vm  --hostname centos  --privileged=true centos:centos7 \/usr\/sbin\/init<\/strong>\n\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165\u5230\u5bb9\u5668centos-vm\n<strong>docker exec -it centos-vm \/bin\/bash<\/strong>\n\u66f4\u65b0\u4e0bcentos\u5305\n<strong>yum update\nyum upgrade<\/strong>\n\u5b89\u88c5\u5e38\u7528\u7684\u5305\u548cssh\n<strong>yum install -y yum-utils device-mapper-persistent-data lvm2 vim\nyum install -y initscripts openssh-server openssl openssl-devel<\/strong>\n<strong>vim \/etc\/ssh\/sshd_config<\/strong>\n# \u627e\u5230\"<strong>PermitRootLogin yes<\/strong>\"\uff0c\u53d6\u6d88\u8fd9\u4e00\u884c\u7684\u6ce8\u91ca\uff0c\u7136\u540e\u4fdd\u5b58\u9000\u51fa\n\u4fee\u6539\u5bc6\u7801\npasswd root\nservice sshd restart\nsystemctl status sshd\n\u5b89\u88c5\u5b9d\u5854\u9762\u677f\n<strong>yum install -y wget &amp;&amp; wget -O install.sh https:\/\/download.bt.cn\/install\/install_6.0.sh &amp;&amp; sh install.sh ed8484bec<\/strong>\n\u5b89\u88c5\u5b8c\u5b9d\u5854\u9762\u677f\u540e\u4fee\u6539\u7528\u6237\u540d\u5bc6\u7801\u7aef\u53e3\u4e3a<strong>999<\/strong>\u4e14\u5b89\u5168\u5165\u53e3\u6539\u4e3a<strong>\/logins<\/strong>\n\u518d\u4ece\u7f51\u9875\u7aef\u767b\u5f55\u5b9d\u5854\u9762\u677f\u5b89\u88c5<strong>Nginx<\/strong>\n\u5b89\u88c5\u5b8c\u6210\u540e\u53ef\u4ee5\u5728\u5b9d\u5854\u9762\u677f\u7f51\u9875\u7528ssh\u94fe\u63a5\u5e76\u770b\u5230Nginx\u5df2\u542f\u52a8\n\u5173\u95ed\u5bb9\u5668\u5e76<strong>\u5bfc\u51fa\u5907\u7528<\/strong>\n\u5bfc\u51fa\u540e\u518d\u8fdb\u884c\u5bfc\u5165\n\u5e76\u5c06\u6e90\u6539\u4e3a<strong>centos-web<\/strong>\n\u7248\u672c\u53f7\u6539\u4e3a<strong>2023<\/strong>\n\u518d\u5229\u7528\u4ee5\u4e0b\u547d\u4ee4\u6839\u636e\u81ea\u5df1\u9700\u8981\u7684\u7aef\u53e3\u8fdb\u884c\u64cd\u4f5c<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>docker run -itd -p 80:80 -p 443:443 -p 9999:999 -p 33060:3306 -p 54320:5432 -p 8880:888 -p 22222:22 --name centos-nginx --hostname centos --privileged=true centos-web:2023 \/usr\/sbin\/init\ndocker run -itd -p 80:80 -p 443:443 -p 9999:999 -p 22222:22 --name centos-nginx --hostname centos --privileged=true centos-web:2023 \/usr\/sbin\/init<\/strong>\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u518d\u8fdb\u5165\u8be5\u5bb9\u5668<strong>centos-nginx<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>docker exec -it centos-nginx \/bin\/bash<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u9700\u624b\u52a8\u5f00\u542fNGINX<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53ea\u80fd\u4f7f\u7528\u4e00\u6b21 \u5982\u679c\u5305\u542b80\u548c443 \u91cd\u542fcentos ssh\u5c06\u4f1a\u5931\u6548 \u3002<br>\u4e0d\u80fd\u91cd\u542fDSM \u3001Docker \u91cd\u542f\u540e\u9700\u8981\u624b\u52a8\u8fdb\u5165docker\u7ec8\u7aef\u673a\u5f00\u542fbt nginx\u7b49\u4e14\u6743\u9650\u6709\u9650 \u4f46\u662f\u591f\u7528<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bt\u518d\u8f93\u51653\u56de\u8f66<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u624b\u52a8\u542f\u52a8Nginx\n<strong>\/etc\/init.d\/nginx restart\n<\/strong>\u91cd\u542f\u7fa4\u6656Docker\u670d\u52a1<strong>\nsynoservice --restart pkgctl-Docker<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u542f\u52a8\u540e\u8fdb\u5165\u5b9d\u5854\u9762\u677f\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u5e26\u57df\u540d\uff08\u5982\uff1a<strong><em>jp.yiyilearning.com<\/em><\/strong>\uff09\u7684\u7f51\u7ad980\u7aef\u53e3\u4ee3\u7406\u5230DSM\u4e3b\u7aef\u53e3\uff0c\u4f8b\u5b50\u5982\u4e0b\uff0c\u53ef\u4ee5\u76f4\u63a5\u754c\u9762\u64cd\u4f5c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n#PROXY-START\/\n\nlocation ^~ \/\n{\n    proxy_pass https:\/\/yiyilearning.com:88\/;\n    proxy_set_header Host yiyilearning.com;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header REMOTE-HOST $remote_addr;\n    proxy_set_header Upgrade $http_upgrade;\n    proxy_set_header Connection $connection_upgrade;\n    proxy_http_version 1.1;\n    # proxy_hide_header Upgrade;\n\n    add_header X-Cache $upstream_cache_status;\n\n    #Set Nginx Cache\n    \n    \n    set $static_fileYLIkKxbl 0;\n    if ( $uri ~* \"\\.(gif|png|jpg|css|js|woff|woff2)$\" )\n    {\n    \tset $static_fileYLIkKxbl 1;\n    \texpires 1m;\n        }\n    if ( $static_fileYLIkKxbl = 0 )\n    {\n    add_header Cache-Control no-cache;\n    }\n}\n\n#PROXY-END\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u90a3\u4e48\u5c31\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7jp.yiyilearning.com\u8bbf\u95eeDSM\uff0c\u914d\u7f6essl\u8bc1\u4e66\u540e\u53ef\u901a\u8fc7<a href=\"https:\/\/jp.yiyilearning.com\/\">https:\/\/jp.yiyilearning.com\/<\/a>\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u60f3\u8981\u5206\u4eab\u6587\u4ef6\u7684\u65f6\u5019\u4e5f\u53ef\u4ee5\u51fa\u76f4\u63a5\u4e0d\u5e26\u7aef\u53e3\u7684link\u76f4\u63a5\u5728DSM\u4e0b\u8bbe\u7f6e<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DSM&#8211;\u63a7\u5236\u9762\u677f&#8211;\u5916\u90e8\u8bbf\u95ee&#8211;\u4e3b\u673a\u540d\u79f0\u8f93\u5165\u521a\u624d\u7684\u57df\u540d(\u5982:jp.yiyilearning.com\uff09\/HTTP80\/HTTPS443\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9e\u73b0\u65e0\u7aef\u53e3\u8bbf\u95ee<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7136\u540e\u518d\u8fdb\u5165\u8be5\u5bb9\u5668centos-nginx \u9700\u624b\u52a8\u5f00\u542fNGINX \u53ea\u80fd\u4f7f\u7528\u4e00\u6b21 \u5982\u679c\u5305\u542b80\u548c443 \u91cd\u542fcentos ssh\u5c06\u4f1a\u5931\u6548 \u3002\u4e0d\u80fd\u91cd\u542fDSM \u3001Docker \u91cd\u542f\u540e\u9700\u8981\u624b\u52a8\u8fdb\u5165docker\u7ec8\u7aef\u673a\u5f00\u542fbt nginx\u7b49\u4e14\u6743\u9650\u6709\u9650 \u4f46\u662f\u591f\u7528 bt\u518d\u8f93\u51653\u56de\u8f66 \u542f\u52a8\u540e\u8fdb\u5165\u5b9d\u5854\u9762\u677f\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u5e26\u57df\u540d\uff08\u5982\uff1ajp.yiyilearning.com\uff09\u7684\u7f51\u7ad980\u7aef\u53e3\u4ee3\u7406\u5230DSM\u4e3b\u7aef\u53e3\uff0c\u4f8b\u5b50\u5982\u4e0b\uff0c\u53ef\u4ee5\u76f4\u63a5\u754c\u9762\u64cd\u4f5c \u90a3\u4e48\u5c31\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7jp.yiyilearning.com\u8bbf\u95eeDSM\uff0c\u914d\u7f6essl\u8bc1\u4e66\u540e\u53ef\u901a\u8fc7https:\/\/jp.yiyilearning.com\/\u8bbf\u95ee\u3002 \u5982\u679c\u60f3\u8981\u5206\u4eab\u6587\u4ef6\u7684\u65f6\u5019\u4e5f\u53ef\u4ee5\u51fa\u76f4\u63a5\u4e0d\u5e26\u7aef\u53e3\u7684link\u76f4\u63a5\u5728DSM\u4e0b\u8bbe\u7f6e DSM&#8211;\u63a7\u5236\u9762\u677f&#8211;\u5916\u90e8\u8bbf\u95ee&#8211;\u4e3b\u673a\u540d\u79f0\u8f93\u5165\u521a\u624d\u7684\u57df\u540d(\u5982:jp.yiyilearning.com\uff09\/HTTP80\/HTTPS443\u5373\u53ef \u5b9e\u73b0\u65e0\u7aef\u53e3\u8bbf\u95ee<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-392","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/posts\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/comments?post=392"}],"version-history":[{"count":9,"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":413,"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/posts\/392\/revisions\/413"}],"wp:attachment":[{"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/media?parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/categories?post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/airlive.online\/index.php\/wp-json\/wp\/v2\/tags?post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}