{"id":20,"date":"2021-04-23T01:03:32","date_gmt":"2021-04-22T17:03:32","guid":{"rendered":"http:\/\/192.168.1.173:8082\/?p=20"},"modified":"2021-05-13T17:16:44","modified_gmt":"2021-05-13T09:16:44","slug":"ubuntu-server-16-04-%e9%85%8d%e7%bd%aenginx-php7-0-mysql-wordpress","status":"publish","type":"post","link":"https:\/\/dmoe.nicolite.cn\/?p=20","title":{"rendered":"Ubuntu Server 16.04 \u914d\u7f6enginx + php7.0 + mysql + wordpress"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">\u5b89\u88c5gcc g++\u7f16\u8bd1\u4f9d\u8d56\u5e93<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get install build-essential\nsudo apt-get install libtool\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5 pcre\u4f9d\u8d56\u5e93<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get update\nsudo apt-get install libpcre3 libpcre3-dev\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5 ssl\u4f9d\u8d56\u5e93<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get install openssl\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5 zlib\u4f9d\u8d56\u5e93<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"> sudo apt-get install zlib1g-dev\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u7f16\u8bd1\u5b89\u88c5nginx<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u53c2\u8003<a href=\"http:\/\/www.cnblogs.com\/piscesLoveCc\/p\/5794926.html\">Ubuntu16.04\u5b89\u88c5nginx<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u4e0b\u8f7dnginx\uff0c\u8fd9\u91cc\u4f7f\u7528\u6700\u65b0\u7a33\u5b9a\u7248\uff0c\u8be5\u7248\u672c\u652f\u6301\u5b89\u5168\u72d7\uff1a\nwget http:\/\/wget http:\/\/nginx.org\/download\/nginx-1.10.3.tar.gz\n#\u89e3\u538b\uff1a\ntar -zxvf nginx-1.10.3.tar.gz\n#\u8fdb\u5165\u89e3\u538b\u76ee\u5f55\uff1a\ncd nginx-1.10.3\n#\u914d\u7f6e\uff1a\n.\/configure --prefix=\/usr\/local\/nginx \n#\u7f16\u8f91nginx\uff1a\nmake\n\u6ce8\u610f\uff1a\u8fd9\u91cc\u53ef\u80fd\u4f1a\u62a5\u9519\uff0c\u63d0\u793a\u201cpcre.h No such file or directory\u201d,\u5177\u4f53\u8be6\u89c1\uff1ahttp:\/\/stackoverflow.com\/questions\/22555561\/error-building-fatal-error-pcre-h-no-such-file-or-directory\n\u9700\u8981\u5b89\u88c5 libpcre3-dev,\u547d\u4ee4\u4e3a\uff1asudo apt-get install libpcre3-dev  \n\u63d0\u5347\u201cerror: SSL modules require the OpenSSL library.\u201d  \n\u9700\u8981\u5b89\u88c5  libssl-dev, \u547d\u4ee4\u4e3a\uff1asudo apt-get install libssl-dev\n#\u5b89\u88c5nginx\uff1a\nsudo make install\n#\u542f\u52a8nginx\uff1a\nsudo \/usr\/local\/nginx\/sbin\/nginx -c \/usr\/local\/nginx\/conf\/nginx.conf\n\u6ce8\u610f\uff1a-c \u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u4e0d\u52a0\u7684\u8bdd\uff0cnginx\u4f1a\u81ea\u52a8\u52a0\u8f7d\u9ed8\u8ba4\u8def\u5f84\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7 -h\u67e5\u770b\u5e2e\u52a9\u547d\u4ee4\u3002\n#\u67e5\u770bnginx\u8fdb\u7a0b\uff1a\nps -ef|grep nginx  \n#\u5efa\u7acb\u8f6f\u94fe\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528nginx\uff0c\u4e0d\u7528\u8f93\u5165\u5b8c\u6574\u8def\u5f84  \nln -sf \/usr\/local\/nginx\/sbin\/nginx \/usr\/sbin\/nginx\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">nginx\u5e38\u7528\u547d\u4ee4<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u542f\u52a8nginx\nsudo nginx\n#t\u505c\u6b62nginx\nsudo nginx -s stop \u6216\u8005 sudo \/usr\/local\/nginx\/sbin\/nginx -s quit\n#\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\n sudo nginx -s reload\n#\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\n sudo nginx -c \/usr\/local\/nginx\/conf\/nginx.conf\n#\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u662f\u5426\u6b63\u786e\n sudo nginx -t\n#\u67e5\u770bnginx\u7248\u672c\n sudo nginx -v\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5php<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u7531\u4e8ephp\u4e0d\u50cfnginx\u90a3\u6837\u5bb9\u6613\u7f16\u8bd1\u6210\u529f\uff0c\u6240\u4ee5\u91c7\u7528apt\u5b89\u88c5\uff0c\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5df1\u7f16\u8bd1\u5b89\u88c5\uff0cubuntu16.04\u4ed3\u5e93\u4e2d\u7684php\u66f4\u65b0\u52307.0\u7248\u672c\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u66f4\u65b0\u8f6f\u4ef6\u6e90\nsudo apt-get update\n#\u5b89\u88c5php7.0\nsudo apt-get install php\n#\u5b89\u88c5mbstring\nsudo apt-get install php7.0-mbstring\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5mysql<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get install mysql-server mysql-client\n\u5b89\u88c5\u7684\u8fc7\u7a0b\u4f1a\u8981\u4f60\u8f93\u5165\u6570\u636e\u5e93root\u7528\u6237\u5bc6\u7801,\u5343\u4e07\u8981\u8bb0\u4f4f\uff0c\u4e0d\u7136\u53c8\u8981\u4e00\u5927\u5806\u9ebb\u70e6\u4e86\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">mysql\u57fa\u672c\u547d\u4ee4<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u66f4\u591a\u8bf7\u767e\u5ea6<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u767b\u5f55\u5230mysql\nmysql -uroot -p\n\u8f93\u5165\u5bc6\u7801\n#\u67e5\u770b\u6709\u54ea\u4e9b\u6570\u636e\u5e93\nshow databases;\n#\u9009\u4e2d\u67d0\u4e2a\u6570\u636e\u5e93\nuse \u6570\u636e\u5e93\u540d\u79f0\n#\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u7684\u8868\u683c\nshow tables\n#\u67e5\u8be2\u6570\u636e\u5e93\nselect * from \u8868\u540d\n#\u65b0\u5efa\u7f16\u7801\u4e3autf8\u7684\u6570\u636e\u5e93\ncreate database \u6570\u636e\u5e93\u540d default set utf8 aollate utf8_general_ci;\n#\u5220\u9664\u6570\u636e\u5e93\ndrop database \u6570\u636e\u5e93\u540d\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6enginx<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/usr\/local\/nginx\/conf\/\nsudo vim nginx.conf\n\n#\u5c06\u6587\u4ef6\u5185\u5bb9\u4fee\u6539\u4e3a\u4e0b\u9762\u8fd9\u6837\n#user  nobody;\nworker_processes  1;\n\n#error_log  logs\/error.log;\n#error_log  logs\/error.log  notice;\n#error_log  logs\/error.log  info;\n\n#pid        logs\/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include       mime.types;\n    default_type  application\/octet-stream;\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    #access_log  logs\/access.log  main;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    #keepalive_timeout  0;\n    keepalive_timeout  65;\n\n    gzip  on;\n    gzip_min_length 1k;\n    gzip_buffers 4 16k;\n    gzip_comp_level 6;\n    gzip_types text\/plain application\/x-javascript text\/css application\/xml text\/javascript application\/x-httpd-php application\/json image\/jpeg image\/gif image\/png;\n    gzip_vary off;\n    gzip_disable \"MSIE[1-6]\\.\";\n\n    server {\n        listen       80;\n        server_name  localhost;\n        #\u8bbe\u7f6e\u7f16\u7801\n        charset utf-8;\n        #\u9690\u85cfnginx\u7248\u672c\u4fe1\u606f\n        server_tokens off;\n        #charset koi8-r;\n\n        #access_log  logs\/host.access.log  main;\n\n        location \/ {\n            root   html;\n            index  index.html index.htm index.php;\n        }\n\n        #error_page  404              \/404.html;\n\n        # redirect server error pages to the static page \/50x.html\n        #\n        error_page   500 502 503 504  \/50x.html;\n        location = \/50x.html {\n            root   html;\n        }\n\n        # proxy the PHP scripts to Apache listening on 127.0.0.1:80\n        #\n        #location ~ \\.php$ {\n        #    proxy_pass   http:\/\/127.0.0.1;\n        #}\n\n        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n        #\n\n       #\u5f00\u542fphp\u6587\u4ef6\u652f\u6301\n        location ~ \\.php$ {\n            root           html;\n            #fastcgi_pass   127.0.0.1:9000;\n            fastcgi_pass   unix:\/run\/php\/php7.0-fpm.sock;\n            fastcgi_index  index.php;\n            fastcgi_param  SCRIPT_FILENAME  \/usr\/local\/nginx\/html$fastcgi_script_name;\n            include        fastcgi_params;\n        }\n\n        # deny access to .htaccess files, if Apache's document root\n        # concurs with nginx's one\n        #\n        location ~ \/\\.ht {\n            deny  all;\n        }\n    }\n\n\n    # another virtual host using mix of IP-, name-, and port-based configuration\n    #\n    #server {\n    #    listen       8000;\n    #    listen       somename:8080;\n    #    server_name  somename  alias  another.alias;\n\n    #    location \/ {\n    #        root   html;\n    #        index  index.html index.htm;\n    #    }\n    #}\n\n\n    # HTTPS server\n    #\n    #server {\n    #    listen       443 ssl;\n    #    server_name  localhost;\n\n    #    ssl_certificate      cert.pem;\n    #    ssl_certificate_key  cert.key;\n\n    #    ssl_session_cache    shared:SSL:1m;\n    #    ssl_session_timeout  5m;\n\n    #    ssl_ciphers  HIGH:!aNULL:!MD5;\n    #    ssl_prefer_server_ciphers  on;\n\n    #    location \/ {\n    #        root   html;\n    #        index  index.html index.htm;\n    #    }\n    #}\n    #\u5305\u542b\u6240\u6709\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u6587\u4ef6\n    include \/usr\/local\/nginx\/vhosts\/*;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6ephp7.0<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u50cf\u4e0a\u9762\u90a3\u6837\u914d\u7f6e\u5b8c\u662f\u6ca1\u6709\u6743\u9650\u6b63\u5e38\u8bbf\u95eephp7.0-fpm\u7684\uff0c\u8fd8\u9700\u8981\u6307\u5b9a\u7528\u6237\u548c\u7528\u6237\u7ec4<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/etc\/php\/7.0\/fpm\/pool.d\nsudo vim www.conf\n\n#\u627e\u5230\u8fd9\u4e2a\n; Set permissions for unix socket, if one is used. In Linux, read\/write\n; permissions must be set in order to allow connections from a web server. Many\n; BSD-derived systems allow connections regardless of permissions.\n; Default Values: user and group are set as the running user\n;                 mode is set to 0660\nlisten.owner = nobody  #\u8fd9\u91cc\u4fee\u6539\u4e3a\u8fd9\u6837\nlisten.group = nobody\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5wordpress<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u4e0b\u8f7d\u6700\u65b0\u7248\nwget https:\/\/cn.wordpress.org\/wordpress-4.7.4-zh_CN.zip\n#\u89e3\u538b\nwget -zxvf wordpress-4.7.4-zh_CN.zip\n#\u5c06wordpress\u4e2d\u7684\u5185\u5bb9\u590d\u5236\u5230nginx\u7f51\u7edc\u76ee\u5f55\ncd wordpress\nsudo cp -r  *  \/usr\/local\/nginx\/html\/\n#\u7ed9worpress\u6dfb\u52a0\u6743\u9650\uff08\u4e0d\u7136worpress\u65e0\u6cd5\u8fdb\u884c\u5220\u9664\u6216\u8005\u662f\u5b89\u88c5\u63d2\u4ef6\u8fd9\u4e9b\u64cd\u4f5c\uff09\ncd \/usr\/local\/nginx\/html\nsudo chown -R www-data:www-data *\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6ewordpress<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u6d4f\u89c8\u5668\u4e0a\u8f93\u5165\u4f60\u670d\u52a1\u5668\u7ed1\u5b9a\u7684\u57df\u540d\u6309\u6b65\u9aa4\u914d\u7f6e\u5c31\u53ef\u4ee5\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5gcc g++\u7f16\u8bd1\u4f9d\u8d56\u5e93 sudo apt-get install build-essential sud [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":68,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2,5],"class_list":["post-20","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-ubuntu","tag-wordpress"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20"}],"version-history":[{"count":1,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions\/21"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=\/wp\/v2\/media\/68"}],"wp:attachment":[{"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dmoe.nicolite.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}