{"id":206,"date":"2020-05-18T06:34:00","date_gmt":"2020-05-18T06:34:00","guid":{"rendered":"https:\/\/blog.chaiyakul.com\/?p=206"},"modified":"2025-05-18T06:46:26","modified_gmt":"2025-05-18T06:46:26","slug":"centos-muti-domain-www","status":"publish","type":"post","link":"https:\/\/blog.chaiyakul.com\/index.php\/2020\/05\/18\/centos-muti-domain-www\/","title":{"rendered":"\u0e27\u0e34\u0e18\u0e35\u0e43\u0e0a\u0e49 CentOS \u0e23\u0e2d\u0e07\u0e23\u0e31\u0e1a\u0e2b\u0e25\u0e32\u0e22\u0e42\u0e14\u0e40\u0e21\u0e19 (\u0e2b\u0e25\u0e32\u0e22\u0e40\u0e27\u0e47\u0e1a\u0e44\u0e0b\u0e15\u0e4c) \u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e01\u0e31\u0e19"},"content":{"rendered":"\n<p><strong>1. \u0e43\u0e0a\u0e49 Apache HTTP Server (httpd) \u0e41\u0e1a\u0e1a Virtual Hosts<\/strong><\/p>\n\n\n\n<p>\u0e16\u0e49\u0e32\u0e04\u0e38\u0e13\u0e43\u0e0a\u0e49 Apache \u0e40\u0e1b\u0e47\u0e19\u0e40\u0e27\u0e47\u0e1a\u0e40\u0e0b\u0e34\u0e23\u0e4c\u0e1f\u0e40\u0e27\u0e2d\u0e23\u0e4c \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 Virtual Hosts \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e23\u0e2d\u0e07\u0e23\u0e31\u0e1a\u0e2b\u0e25\u0e32\u0e22\u0e42\u0e14\u0e40\u0e21\u0e19\u0e1a\u0e19\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e40\u0e14\u0e35\u0e22\u0e27\u0e44\u0e14\u0e49 \u0e40\u0e0a\u0e48\u0e19<\/p>\n\n\n\n<p>\u0e15\u0e34\u0e14\u0e15\u0e31\u0e49\u0e07 Apache (\u0e16\u0e49\u0e32\u0e22\u0e31\u0e07\u0e44\u0e21\u0e48\u0e21\u0e35)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo yum install httpd\nsudo systemctl start httpd\nsudo systemctl enable httpd\n<\/pre><\/div>\n\n\n<p>\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c Virtual Host \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e41\u0e15\u0e48\u0e25\u0e30\u0e42\u0e14\u0e40\u0e21\u0e19\u0e43\u0e19 <span style=\"background-color:#F6F6F6\" class=\"has-inline-background\"><code>\/etc\/httpd\/conf.d\/<\/code><br>\u0e40\u0e0a\u0e48\u0e19 <code>\/etc\/httpd\/conf.d\/domain1.conf<\/code>:<\/span><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;VirtualHost *:80&gt;\n    ServerName domain1.com\n    ServerAlias www.domain1.com\n    DocumentRoot \/var\/www\/domain1\n    ErrorLog \/var\/log\/httpd\/domain1-error.log\n    CustomLog \/var\/log\/httpd\/domain1-access.log combined\n&amp;lt;\/VirtualHost&gt;\n<\/pre><\/div>\n\n\n<p>\u0e41\u0e25\u0e30\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a domain2 \u0e01\u0e47\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c\u0e04\u0e25\u0e49\u0e32\u0e22\u0e01\u0e31\u0e19<\/p>\n\n\n\n<p>\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e40\u0e27\u0e47\u0e1a\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e41\u0e15\u0e48\u0e25\u0e30\u0e42\u0e14\u0e40\u0e21\u0e19 \u0e40\u0e0a\u0e48\u0e19<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir -p \/var\/www\/domain1\nmkdir -p \/var\/www\/domain2\n<\/pre><\/div>\n\n\n<p>\u0e23\u0e35\u0e2a\u0e15\u0e32\u0e23\u0e4c\u0e17 Apache<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl restart httpd\n<\/pre><\/div>\n\n\n<p><strong>2. \u0e43\u0e0a\u0e49 Nginx \u0e41\u0e1a\u0e1a Server Blocks (Virtual Hosts \u0e02\u0e2d\u0e07 Nginx)<\/strong><\/p>\n\n\n\n<p>\u0e16\u0e49\u0e32\u0e43\u0e0a\u0e49 Nginx \u0e01\u0e47\u0e08\u0e30\u0e43\u0e0a\u0e49\u0e41\u0e19\u0e27\u0e04\u0e34\u0e14\u0e40\u0e14\u0e35\u0e22\u0e27\u0e01\u0e31\u0e19<\/p>\n\n\n\n<p>\u0e15\u0e34\u0e14\u0e15\u0e31\u0e49\u0e07 Nginx<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo yum install nginx\nsudo systemctl start nginx\nsudo systemctl enable nginx\n<\/pre><\/div>\n\n\n<p>\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c config \u0e02\u0e2d\u0e07\u0e41\u0e15\u0e48\u0e25\u0e30\u0e42\u0e14\u0e40\u0e21\u0e19\u0e43\u0e19 <code><span style=\"background-color:#F6F6F6\" class=\"has-inline-background\">\/etc\/nginx\/conf.d\/domain1.conf<\/span><\/code><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nserver {\n    listen 80;\n    server_name domain1.com www.domain1.com;\n\n    root \/usr\/share\/nginx\/domain1;\n    index index.html index.htm;\n\n    access_log \/var\/log\/nginx\/domain1-access.log;\n    error_log \/var\/log\/nginx\/domain1-error.log;\n}\n<\/pre><\/div>\n\n\n<p>\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e40\u0e27\u0e47\u0e1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir -p \/usr\/share\/nginx\/domain1\n<\/pre><\/div>\n\n\n<p>\u0e23\u0e35\u0e2a\u0e15\u0e32\u0e23\u0e4c\u0e17 nginx<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl restart nginx\n<\/pre><\/div>\n\n\n<p>\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e2b\u0e15\u0e38<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0e15\u0e49\u0e2d\u0e07\u0e0a\u0e35\u0e49 DNS \u0e02\u0e2d\u0e07\u0e42\u0e14\u0e40\u0e21\u0e19\u0e44\u0e1b\u0e17\u0e35\u0e48 IP \u0e02\u0e2d\u0e07\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07 CentOS \u0e19\u0e35\u0e49\u0e14\u0e49\u0e27\u0e22<\/li>\n\n\n\n<li>\u0e2b\u0e32\u0e01\u0e43\u0e0a\u0e49 SSL (https) \u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 cert \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e41\u0e15\u0e48\u0e25\u0e30\u0e42\u0e14\u0e40\u0e21\u0e19 \u0e40\u0e0a\u0e48\u0e19 \u0e43\u0e0a\u0e49 Let&#8217;s Encrypt<\/li>\n\n\n\n<li>\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e23\u0e31\u0e19\u0e40\u0e27\u0e47\u0e1a\u0e41\u0e2d\u0e1b \u0e2b\u0e23\u0e37\u0e2d service \u0e2d\u0e37\u0e48\u0e19\u0e46 \u0e1a\u0e19\u0e1e\u0e2d\u0e23\u0e4c\u0e15\u0e15\u0e48\u0e32\u0e07\u0e46 \u0e41\u0e25\u0e49\u0e27\u0e17\u0e33 reverse proxy \u0e1c\u0e48\u0e32\u0e19 Apache \u0e2b\u0e23\u0e37\u0e2d Nginx \u0e44\u0e14\u0e49<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u0e43\u0e0a\u0e49 Apache HTTP Server (httpd) \u0e41\u0e1a\u0e1a Virtual Hosts \u0e16\u0e49\u0e32 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[105,9],"tags":[],"class_list":["post-206","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/comments?post=206"}],"version-history":[{"count":4,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/206\/revisions"}],"predecessor-version":[{"id":210,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/206\/revisions\/210"}],"wp:attachment":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/media?parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/categories?post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/tags?post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}