{"id":219,"date":"2024-03-03T16:35:48","date_gmt":"2024-03-03T08:35:48","guid":{"rendered":"https:\/\/669082.xyz\/?p=219"},"modified":"2024-03-03T18:33:42","modified_gmt":"2024-03-03T10:33:42","slug":"centos7%e6%89%8b%e5%8a%a8%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85nginx%e4%b8%8ephp","status":"publish","type":"post","link":"https:\/\/669082.xyz\/index.php\/2024\/03\/03\/centos7%e6%89%8b%e5%8a%a8%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85nginx%e4%b8%8ephp\/","title":{"rendered":"centos7\u624b\u52a8\u7f16\u8bd1\u5b89\u88c5nginx\u4e0ephp"},"content":{"rendered":"<h4>\u7f16\u8bd1\u5b89\u88c5nginx1.25<\/h4>\n<pre><code class=\"language-shell\">#\u5b89\u88c5\u4f9d\u8d56\nyum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel \n\n#\u4e0b\u8f7d\u6e90\u7801\u5e76\u89e3\u538b\ncd \/usr\/local\/src\nwget http:\/\/nginx.org\/download\/nginx-1.25.3.tar.gz\ntar -zxvf nginx-1.25.3.tar.gz\n\n#\u7f16\u8bd1\u5b89\u88c5\ncd nginx-1.25.3\n.\/configure --prefix=\/usr\/local\/nginx --with-http_ssl_module --with-http_v2_module --with-stream\nmake &amp;&amp; make install\n\n#\u521b\u5efa\u8f6f\u8fde\u63a5\nln -s \/usr\/local\/nginx\/sbin\/nginx \/usr\/bin\/nginx\n\n#\u521b\u5efa\u670d\u52a1\nvi \/lib\/systemd\/system\/nginx.service\n#\u586b\u5165\u4ee5\u4e0b\u5185\u5bb9\n[Unit]\nDescription=nginx service\nAfter=network.target \n\n[Service] \nType=forking \nExecStart=\/usr\/local\/nginx\/sbin\/nginx\nExecReload=\/usr\/local\/nginx\/sbin\/nginx -s reload\nExecStop=\/usr\/local\/nginx\/sbin\/nginx -s quit\nPrivateTmp=true \n\n[Install] \nWantedBy=multi-user.target\n\n#\u6d4b\u8bd5\n#\u5f00\u542fnginx\nsystemctl restart nginx\nsystemctl enable nginx\n#\u9632\u706b\u5899\u653e\u884c80\u7aef\u53e3\uff0c\u7136\u540e\u6d4f\u89c8\u5668\u8bbf\u95ee\nfirewall-cmd --permanent --zone=public --add-port=80\/tcp\nfirewall-cmd --reload<\/code><\/pre>\n<h4>\u7f16\u8bd1\u5b89\u88c5php7.2<\/h4>\n<pre><code class=\"language-shell\">#\u5b89\u88c5\u4f9d\u8d56\nyum install gcc autoconf gcc-c++\nyum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel readline readline-devel libxslt libxslt-devel\nyum install systemd-devel\nyum install openjpeg-devel\n\n#\u4e0b\u8f7d\u6e90\u4ee3\u7801\ncd \/usr\/local\/src\nwget https:\/\/www.php.net\/distributions\/php-7.2.28.tar.gz\ntar -zxvf php-7.2.28.tar.gz\n\n#\u65b0\u5efa\u7528\u6237\u53ca\u7ec4\ngroupadd php-fpm\nuseradd -s \/sbin\/nologin -g php-fpm -M php-fpm\n\n#\u7f16\u8bd1\u53ca\u5b89\u88c5\ncd \/usr\/local\/src\/php-7.2.28\n\n.\/configure \\\n--prefix=\/usr\/local\/php \\\n--with-config-file-path=\/usr\/local\/php\/etc \\\n--with-zlib-dir \\\n--with-freetype-dir \\\n--enable-mbstring \\\n--with-libxml-dir=\/usr \\\n--enable-xmlreader \\\n--enable-xmlwriter \\\n--enable-soap \\\n--enable-calendar \\\n--with-curl \\\n--with-zlib \\\n--with-gd \\\n--with-pdo-sqlite \\\n--with-pdo-mysql \\\n--with-mysqli \\\n--with-mysql-sock \\\n--enable-mysqlnd \\\n--disable-rpath \\\n--enable-inline-optimization \\\n--with-bz2 \\\n--with-zlib \\\n--enable-sockets \\\n--enable-sysvsem \\\n--enable-sysvshm \\\n--enable-pcntl \\\n--enable-mbregex \\\n--enable-exif \\\n--enable-bcmath \\\n--with-mhash \\\n--enable-zip \\\n--with-pcre-regex \\\n--with-jpeg-dir=\/usr \\\n--with-png-dir=\/usr \\\n--with-openssl \\\n--enable-ftp \\\n--with-kerberos \\\n--with-gettext \\\n--with-xmlrpc \\\n--with-xsl \\\n--enable-fpm \\\n--with-fpm-user=php-fpm \\\n--with-fpm-group=php-fpm \\\n--with-fpm-systemd \\\n--disable-fileinfo\n\nmake &amp;&amp; make install\n\n#\u914d\u7f6e\ncp \/usr\/local\/src\/php-7.2.28\/php.ini-production \/usr\/local\/php\/etc\/php.ini\ncp \/usr\/local\/php\/etc\/php-fpm.conf.default \/usr\/local\/php\/etc\/php-fpm.conf\n\n#\u914d\u7f6e\u9519\u8bef\u6587\u4ef6\u4f4d\u7f6e \u53capid\nvi \/usr\/local\/php\/etc\/php-fpm.conf\nerror_log = \/var\/log\/php-fpm.log\npid = \/usr\/local\/php\/var\/run\/php-fpm.pid\n\ncp \/usr\/local\/php\/etc\/php-fpm.d\/www.conf.default  \/usr\/local\/php\/etc\/php-fpm.d\/www.conf\n\n#\u914d\u7f6e\u670d\u52a1\ncp \/usr\/local\/src\/php-7.2.28\/sapi\/fpm\/php-fpm.service \/usr\/lib\/systemd\/system\/\n\n#\u542f\u52a8\nsystemctl enable php-fpm\nsystemctl restart php-fpm\n\n#\u6dfb\u52a0\u73af\u5883\u53d8\u91cf:\nvi  \/etc\/profile\nexport PATH=$PATH:&#039;\/usr\/local\/php\/bin\/&#039;\n\nsource \/etc\/profile\n\n#\u53c2\u8003\u8d44\u6599\nhttps:\/\/learnku.com\/articles\/41767<\/code><\/pre>\n<h4>nginx\u914d\u7f6ephp\u7f51\u7ad9<\/h4>\n<pre><code class=\"language-sehll\">server {\n    listen       80;\n    server_name  127.0.0.1;\n    root \/www\/test;\n\n    location \/ {       \n        index index.php;\n        autoindex on;\n    }  \n\n    location ~ \\.php$ {       \n        fastcgi_intercept_errors on;       \n        fastcgi_pass   127.0.0.1:9000;\n        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n        include fastcgi_params;\n    }\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7f16\u8bd1\u5b89\u88c5nginx1.25 #\u5b89\u88c5\u4f9d\u8d56 yum install -y gcc-c++ pcre pc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-219","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":3,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts\/219\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/posts\/219\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/669082.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}