{"id":50,"date":"2024-08-06T11:45:16","date_gmt":"2024-08-06T03:45:16","guid":{"rendered":"https:\/\/blog.62510360.xyz\/?p=50"},"modified":"2024-08-06T11:45:16","modified_gmt":"2024-08-06T03:45:16","slug":"%e7%94%a8docker%e6%90%ad%e5%bb%ba-ldnmp%e5%bb%ba%e7%ab%99","status":"publish","type":"post","link":"https:\/\/blog.62510360.xyz\/?p=50","title":{"rendered":"\u7528docker\u642d\u5efa LDNMP\u5efa\u7ad9"},"content":{"rendered":"\n<p>\u81ea\u5df1\u5206\u6790\u6574\u7406\u642d\u5efa\u65b9\u6cd5 \u65e0\u9700\u4efb\u4f55\u9762\u677f \u5f92\u624bdocker\u642d\u5efa\u5efa\u7ad9\u73af\u5883 \u4e3a\u5565\u8981\u7528\u4ee3\u7801\u642d\u5efa\u7f51\u7ad9 \u4e3a\u4e86\u4ee5\u540e\u4e00\u952e\u642d\u5efa\u7f51\u7ad9\u505a\u51c6\u5907\uff01<\/p>\n\n\n\n<p>\u6280\u672f\u96be\u70b9\u5168\u90e8\u653b\u514b \u592a\u68d2\u4e86 \u4e3a\u4ec0\u4e48\u8fd9\u4e48\u5174\u594b \u662f\u56e0\u4e3a\u6211\u4eec\u6709\u4e86LNMP \uff08Linux Nginx Mysql Php\uff09<\/p>\n\n\n\n<p>\u53ea\u8981\u7ed9\u6211\u6e90\u7801\u5c31\u53ef\u4ee5\u642d\u5efa\u7f51\u7ad9 \u800c\u4e14\u90fd\u662f\u6700\u65b0\u7248\u672c\u7684\u73af\u5883 \u901f\u5ea6\u560e\u560e\u5feb\uff01&nbsp;<\/p>\n\n\n\n<p>\u66f4\u65b0\u7cfb\u7edf<\/p>\n\n\n\n<p>apt update -y&nbsp; &amp;&amp; apt upgrade -y &amp;&amp; apt install -y curl wget sudo socat<\/p>\n\n\n\n<p>\u5b89\u88c5docker<\/p>\n\n\n\n<p>curl -fsSL https:\/\/get.docker.com | sh<\/p>\n\n\n\n<p>curl -L &#8220;https:\/\/github.com\/docker\/compose\/releases\/latest\/download\/docker-compose-$(uname -s)-$(uname -m)&#8221; -o \/usr\/local\/bin\/docker-compose<\/p>\n\n\n\n<p>chmod +x \/usr\/local\/bin\/docker-compose<\/p>\n\n\n\n<p>\u521b\u5efa\u76ee\u5f55<\/p>\n\n\n\n<p>cd \/home<\/p>\n\n\n\n<p>mkdir web<\/p>\n\n\n\n<p>cd web<\/p>\n\n\n\n<p>mkdir html<\/p>\n\n\n\n<p>mkdir mysql<\/p>\n\n\n\n<p>mkdir certs<\/p>\n\n\n\n<p>touch nginx.conf<\/p>\n\n\n\n<p>nano docker-compose.yml<\/p>\n\n\n\n<p>\u914d\u7f6edocker-compose<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/kejilion\/docker\/blob\/main\/LNMP-docker-compose.yml\">https:\/\/github.com\/kejilion\/docker\/blob\/main\/LNMP-docker-compose.yml<\/a><\/p>\n\n\n\n<p>\u7533\u8bf7\u8bc1\u4e66<\/p>\n\n\n\n<p>curl https:\/\/get.acme.sh | sh<\/p>\n\n\n\n<p>~\/.acme.sh\/acme.sh &#8211;register-account -m xxxx@gmail.com<\/p>\n\n\n\n<p>~\/.acme.sh\/acme.sh &#8211;issue -d s.kejilion.eu.org &#8211;standalone<\/p>\n\n\n\n<p>\u4e0b\u8f7d\u8bc1\u4e66<\/p>\n\n\n\n<p>~\/.acme.sh\/acme.sh &#8211;installcert -d s.kejilion.eu.org&nbsp;&#8211;key-file \/home\/web\/certs\/key.pem &#8211;fullchain-file \/home\/web\/certs\/cert.pem<\/p>\n\n\n\n<p>NGINX\u914d\u7f6e<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/kejilion\/nginx\/blob\/main\/nginx5.conf\">https:\/\/github.com\/kejilion\/nginx\/blob\/main\/nginx5.conf<\/a><\/p>\n\n\n\n<p>\u4e0b\u8f7d\u6e90\u7801<\/p>\n\n\n\n<p>maccms10<\/p>\n\n\n\n<p>cd \/home\/web &amp;&amp; wget https:\/\/github.com\/magicblack\/maccms_down\/raw\/master\/maccms10.zip &amp;&amp; sudo apt-get install -y unzip &amp;&amp; unzip maccms10.zip -d html &amp;&amp; rm maccms10.zip &amp;&amp; mv \/home\/web\/html\/maccms10-master\/* \/home\/web\/html\/<\/p>\n\n\n\n<p>wordpress<\/p>\n\n\n\n<p>cd \/home\/web &amp;&amp; wget https:\/\/cn.wordpress.org\/wordpress-6.2.2-zh_CN.zip &amp;&amp; sudo apt-get install -y unzip &amp;&amp; unzip wordpress-6.2.2-zh_CN.zip -d html &amp;&amp; rm wordpress-6.2.2-zh_CN.zip &amp;&amp; mv \/home\/web\/html\/wordpress\/* \/home\/web\/html\/<\/p>\n\n\n\n<p>\u8fd0\u884c<\/p>\n\n\n\n<p>cd \/home\/web &amp;&amp; docker-compose up -d<\/p>\n\n\n\n<p>\u8d4b\u4e88\u6743\u9650<\/p>\n\n\n\n<p>docker exec -it nginx chmod -R 777 \/var\/www\/html<\/p>\n\n\n\n<p>docker exec -it php chmod -R 777 \/var\/www\/html<\/p>\n\n\n\n<p>\u5b89\u88c5PHP\u6269\u5c55<\/p>\n\n\n\n<p>docker exec php apt update &amp;&amp;&nbsp;docker exec php apt install -y libmariadb-dev-compat libmariadb-dev libzip-dev&nbsp;libmagickwand-dev imagemagick<\/p>\n\n\n\n<p>docker exec php docker-php-ext-install mysqli pdo_mysql zip exif gd&nbsp;intl&nbsp;bcmath opcache<\/p>\n\n\n\n<p>docker exec php pecl install imagick &amp;&amp;&nbsp;docker exec php sh -c &#8216;echo &#8220;extension=imagick.so&#8221; &gt; \/usr\/local\/etc\/php\/conf.d\/imagick.ini&#8217;<\/p>\n\n\n\n<p>docker exec -it php sh -c &#8216;echo &#8220;upload_max_filesize=50M \\n post_max_size=50M&#8221; &gt; \/usr\/local\/etc\/php\/conf.d\/uploads.ini&#8217;<\/p>\n\n\n\n<p>\u91cd\u542fphp<\/p>\n\n\n\n<p>docker restart php<\/p>\n\n\n\n<p>\u53ef\u4ee5\u53bb\u8bbf\u95ee\u4f60\u7684\u57df\u540d\u4e86\uff0c\u5b8c\u6210wp\u5b89\u88c5\u5411\u5bfc\u540e\u518d\u8f93\u5165\u4e0b\u9762\u7684\u547d\u4ee4\uff01<\/p>\n\n\n\n<p>\u8df3\u8fc7FTP\u66f4\u65b0\u4e3b\u9898\u63d2\u4ef6\u7684\u9650\u5236<\/p>\n\n\n\n<p>echo &#8220;define(&#8216;FS_METHOD&#8217;, &#8216;direct&#8217;);&#8221; &gt;&gt; \/home\/web\/html\/wp-config.php<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u81ea\u5df1\u5206\u6790\u6574\u7406\u642d\u5efa\u65b9\u6cd5 \u65e0\u9700\u4efb\u4f55\u9762\u677f \u5f92\u624bdocker\u642d\u5efa\u5efa\u7ad9\u73af\u5883 \u4e3a\u5565\u8981\u7528\u4ee3\u7801\u642d\u5efa\u7f51\u7ad9 \u4e3a\u4e86\u4ee5\u540e\u4e00\u952e\u642d\u5efa\u7f51\u7ad9\u505a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-wlzy"],"_links":{"self":[{"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=50"}],"version-history":[{"count":1,"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":51,"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions\/51"}],"wp:attachment":[{"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.62510360.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}