{"id":278,"date":"2024-11-14T13:41:28","date_gmt":"2024-11-14T05:41:28","guid":{"rendered":"https:\/\/telaker.cn\/?p=278"},"modified":"2024-11-14T13:41:29","modified_gmt":"2024-11-14T05:41:29","slug":"apache2-01","status":"publish","type":"post","link":"https:\/\/telaker.cn\/index.php\/2024\/11\/14\/apache2-01\/","title":{"rendered":"Apache2\u8f6c\u53d1\u5185\u7f51\u7aef\u53e3\u6d41\u91cf"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u5b89\u88c5Apache2<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get apache2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u88c5\u4ee3\u7406\u6a21\u5757\uff08\u975e\u5fc5\u8981\uff09<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#Ubuntu\u6216Debian\u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\nsudo apt-get install libapache2-mod-proxy libapache2-mod-proxy-http\n#\u6811\u8393\u6d3e\u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\nsudo apt-get install apache2-mod-proxy apache2-mod-proxy-http<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6216\u8005\uff0c\u76f4\u63a5\u4f7f\u7528\u547d\u4ee4a2enmod\u542f\u7528\u6a21\u5757<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enmod proxy<br>sudo a2enmod proxy_http<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u6587\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u5728\/etc\/apache2\/sites-available\/\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e0b\u5217\u5185\u5bb9\n&lt;VirtualHost *:80>\n    ServerName yourdomain.com\n    ProxyPass \/ http:\/\/127.0.0.1:8080\/\n    ProxyPassReverse \/ http:\/\/127.0.0.1:8080\/\n&lt;\/VirtualHost>\n\n#\u5728\/etc\/apache2\/ports.conf\u4e2d\u6dfb\u52a0\u4e0b\u5217\u5185\u5bb9\uff0c\u542f\u7528\u76d1\u542c\nListen 80<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u68c0\u67e5\u8bed\u6cd5\u662f\u5426\u6b63\u786e<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apachectl configtest<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u91cd\u542fapache2<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2\n#\u6216\u8005\uff0c\u65e7\u7248\u672cinit.d\u811a\u672c\u7528\nsudo service apache2 restart<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5Apache2 \u5b89\u88c5\u4ee3\u7406\u6a21\u5757\uff08\u975e\u5fc5\u8981\uff09 \u6216\u8005\uff0c\u76f4\u63a5\u4f7f\u7528\u547d\u4ee4a2enmod\u542f\u7528\u6a21\u5757 \u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u6587\u4ef6 \u68c0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[19],"class_list":["post-278","post","type-post","status-publish","format-standard","hentry","category-apache2","tag-ports"],"_links":{"self":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/posts\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/comments?post=278"}],"version-history":[{"count":0,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/posts\/278\/revisions"}],"wp:attachment":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}