{"id":45248,"date":"2024-10-06T21:31:33","date_gmt":"2024-10-06T13:31:33","guid":{"rendered":"https:\/\/server.hk\/cnblog\/45248\/"},"modified":"2024-10-06T21:31:33","modified_gmt":"2024-10-06T13:31:33","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-centos-7-%e4%b8%ad%e5%9c%a8-hhvm-%e5%92%8c-nginx-%e4%b9%8b%e4%b8%8a%e5%ae%89%e8%a3%9d-wordpress","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/45248\/","title":{"rendered":"\u5982\u4f55\u5728 CentOS 7 \u4e2d\u5728 HHVM \u548c Nginx \u4e4b\u4e0a\u5b89\u88dd WordPress"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-centos-7-%e4%b8%ad%e5%9c%a8-hhvm-%e5%92%8c-nginx-%e4%b9%8b%e4%b8%8a%e5%ae%89%e8%a3%9d-wordpress-AvAXzdauLj\">\u5982\u4f55\u5728 CentOS 7 \u4e2d\u5728 HHVM \u548c Nginx \u4e4b\u4e0a\u5b89\u88dd WordPress<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0cWordPress \u662f\u6700\u53d7\u6b61\u8fce\u7684\u5167\u5bb9\u7ba1\u7406\u7cfb\u7d71\u4e4b\u4e00\u3002\u7d50\u5408 HHVM\uff08HipHop Virtual Machine\uff09\u548c Nginx\uff0c\u60a8\u53ef\u4ee5\u986f\u8457\u63d0\u9ad8\u7db2\u7ad9\u7684\u6027\u80fd\u548c\u97ff\u61c9\u901f\u5ea6\u3002\u672c\u6587\u5c07\u6307\u5c0e\u60a8\u5982\u4f55\u5728 CentOS 7 \u4e0a\u5b89\u88dd HHVM \u548c Nginx\uff0c\u4e26\u5728\u5176\u4e0a\u5b89\u88dd WordPress\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-AvAXzdauLj\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u60a8\u7684 CentOS 7 \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u5de5\u5177\u548c\u5eab\uff1a<\/p>\n<pre><code>sudo yum install -y epel-release\nsudo yum install -y wget curl<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-nginx-AvAXzdauLj\">\u5b89\u88dd Nginx<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88dd Nginx\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88dd Nginx\uff1a<\/p>\n<pre><code>sudo yum install -y nginx<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 Nginx \u4e26\u8a2d\u7f6e\u5176\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start nginx\nsudo systemctl enable nginx<\/code><\/pre>\n<p>\u60a8\u53ef\u4ee5\u901a\u904e\u8a2a\u554f\u60a8\u7684\u4f3a\u670d\u5668 IP \u5730\u5740\u4f86\u6aa2\u67e5 Nginx \u662f\u5426\u904b\u884c\u6b63\u5e38\u3002\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u61c9\u8a72\u80fd\u770b\u5230 Nginx \u7684\u6b61\u8fce\u9801\u9762\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-hhvm-AvAXzdauLj\">\u5b89\u88dd HHVM<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u5c07\u5b89\u88dd HHVM\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u6dfb\u52a0 HHVM \u7684\u5b98\u65b9\u5b58\u5132\u5eab\uff1a<\/p>\n<pre><code>sudo wget -O \/etc\/yum.repos.d\/hhvm.repo https:\/\/dl.hhvm.com\/centos\/hhvm.repo<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5b89\u88dd HHVM\uff1a<\/p>\n<pre><code>sudo yum install -y hhvm<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 HHVM \u4e26\u8a2d\u7f6e\u5176\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start hhvm\nsudo systemctl enable hhvm<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-nginx-%e8%88%87-hhvm-AvAXzdauLj\">\u914d\u7f6e Nginx \u8207 HHVM<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e Nginx \u4ee5\u4f7f\u7528 HHVM\u3002\u7de8\u8f2f Nginx \u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/nginx\/conf.d\/wordpress.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre><code>server {\n    listen 80;\n    server_name your_domain.com;  # \u66ff\u63db\u70ba\u60a8\u7684\u57df\u540d\u6216\u4f3a\u670d\u5668 IP\n    root \/var\/www\/html;           # WordPress \u7684\u6839\u76ee\u9304\n    index index.php index.html index.htm;\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php?$args;\n    }\n\n    location ~ .php$ {\n        include fastcgi_params;\n        fastcgi_pass 127.0.0.1:9000;  # HHVM \u7684\u9ed8\u8a8d\u7aef\u53e3\n        fastcgi_index index.php;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n    }\n}\n<\/code><\/pre>\n<p>\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\uff0c\u7136\u5f8c\u6aa2\u67e5 Nginx \u914d\u7f6e\u662f\u5426\u6b63\u78ba\uff1a<\/p>\n<pre><code>sudo nginx -t<\/code><\/pre>\n<p>\u5982\u679c\u6c92\u6709\u932f\u8aa4\uff0c\u91cd\u65b0\u52a0\u8f09 Nginx \u914d\u7f6e\uff1a<\/p>\n<pre><code>sudo systemctl reload nginx<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-wordpress-AvAXzdauLj\">\u5b89\u88dd WordPress<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u958b\u59cb\u5b89\u88dd WordPress\u3002\u9996\u5148\uff0c\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684 WordPress\uff1a<\/p>\n<pre><code>wget https:\/\/wordpress.org\/latest.tar.gz\ntar -xzvf latest.tar.gz\nsudo mv wordpress\/* \/var\/www\/html\/\n<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u8a2d\u7f6e WordPress \u7684\u76ee\u9304\u6b0a\u9650\uff1a<\/p>\n<pre><code>sudo chown -R nginx:nginx \/var\/www\/html\/\nsudo chmod -R 755 \/var\/www\/html\/<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u60a8\u9700\u8981\u5275\u5efa\u4e00\u500b MySQL \u6578\u64da\u5eab\u548c\u7528\u6236\u3002\u9996\u5148\uff0c\u5b89\u88dd MySQL\uff1a<\/p>\n<pre><code>sudo yum install -y mariadb-server\nsudo systemctl start mariadb\nsudo systemctl enable mariadb<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u904b\u884c\u5b89\u5168\u8173\u672c\u4ee5\u8a2d\u7f6e MySQL \u5bc6\u78bc\u548c\u5b89\u5168\u9078\u9805\uff1a<\/p>\n<pre><code>sudo mysql_secure_installation<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u767b\u9304 MySQL \u4e26\u5275\u5efa\u6578\u64da\u5eab\u548c\u7528\u6236\uff1a<\/p>\n<pre><code>mysql -u root -p\nCREATE DATABASE wordpress;\nCREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'your_password';\nGRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n<h2 id=\"%e5%ae%8c%e6%88%90%e5%ae%89%e8%a3%9d-AvAXzdauLj\">\u5b8c\u6210\u5b89\u88dd<\/h2>\n<p>\u6700\u5f8c\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u8a2a\u554f\u60a8\u7684\u57df\u540d\u6216\u4f3a\u670d\u5668 IP \u5730\u5740\u4f86\u5b8c\u6210 WordPress \u7684\u5b89\u88dd\u3002\u6309\u7167\u5c4f\u5e55\u4e0a\u7684\u6307\u793a\u9032\u884c\u8a2d\u7f6e\uff0c\u8f38\u5165\u525b\u624d\u5275\u5efa\u7684\u6578\u64da\u5eab\u4fe1\u606f\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-AvAXzdauLj\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u5df2\u7d93\u6210\u529f\u5728 CentOS 7 \u4e2d\u5b89\u88dd\u4e86 HHVM \u548c Nginx\uff0c\u4e26\u5728\u5176\u4e0a\u5b89\u88dd\u4e86 WordPress\u3002\u9019\u7a2e\u7d44\u5408\u4e0d\u50c5\u80fd\u63d0\u9ad8\u7db2\u7ad9\u7684\u6027\u80fd\uff0c\u9084\u80fd\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6236\u9ad4\u9a57\u3002\u5982\u679c\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u652f\u6301\u6216\u5c0b\u627e\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 CentOS 7 \u4e0a\u5b78\u7fd2\u5982\u4f55\u5728 HHVM \u548c Nginx \u74b0\u5883\u4e2d\u5b89\u88dd WordPress\uff0c\u63d0\u5347\u7db2\u7ad9\u6027\u80fd\u8207\u901f\u5ea6\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-45248","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=45248"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45248\/revisions"}],"predecessor-version":[{"id":45249,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45248\/revisions\/45249"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=45248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=45248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=45248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}