Linux/Unix下nginx+php安装简明教程
一、安装nginx: 1. 安装pcre库,nginx的rewrite模板需用到pcre库: 1. mkdir -p /works 2. cd /works 3. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz 4. tar -zxvf pcre-8.20.tar.gz 5. ./configure 6. make make install 7
一、安装nginx:
1. 安装pcre库,nginx的rewrite模板需用到pcre库:
1. mkdir -p /works
2. cd /works
3. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
4. tar -zxvf pcre-8.20.tar.gz
5. ./configure
6. make && make install
7. cd ..
2. 安装nginx: www.2cto.com
1. wget http://nginx.org/download/nginx-1.0.10.tar.gz
2. tar -zxvf nginx-1.0.10.tar.gz
3. cd nginx-1.0.10
4. ./configure
5. make && make install
6. cd ..
3. 新建用户和组:
1. groupadd www
2. useradd -r -g www www
二、安装PHP5
1. 安装依赖包:
1. libcurl:
2. wget http://curl.haxx.se/download/curl-7.23.1.tar.gz
3. tar -zxvf curl-7.23.1.tar.gz
4. cd curl-7.23.1/
5. ./configure
6. make && make install
7. cd ..
libxml2:
1. wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
2. tar -zxvf libxml2-2.7.6.tar.gz
3. cd libxml2-2.7.6
4. ./configure
5. make && make install
6. cd ..
libxslt:
1. wget ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
2. tar -zxvf libxslt-1.1.24.tar.gz
3. cd libxslt-1.1.24
4. ./configure make && make install
5. cd ..
freetype:
1. wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.gz
2. tar -zxvf freetype-2.4.6.tar.gz
3. cd freetype-2.4.6 ./configure
4. make && make install
5. cd ..
libpng:
1. wget "http://prdownloads.sourceforge.net/libpng/libpng-1.5.6.tar.gz?download"
2. tar -zxvf libpng-1.5.6.tar.gz
3. cd libpng-1.5.6 ./configure
4. make && make install
5. cd ..
libjpeg:
1. wget http://ijg.org/files/jpegsrc.v8c.tar.gz
2. tar -zxvf jpegsrc.v8c.tar.gz
3. cd jpeg-8c/
4. ./configure
5. make && make install
6. cd ..
2. 安装php5和php-fpm:
1. wget http://museum.php.net/php5/php-5.2.16.tar.gz
2. wget http://php-fpm.org/downloads/php-5.2.16-fpm-0.5.14.diff.gz
3. tar -zxvf php-5.2.16.tar.gz
4. gunzip php-5.2.16-fpm-0.5.14.diff.gz
5. cd php-5.2.16/
6. patch -p1
7.
8. ./configure \
9. --with-curl \
10. --enable-calendar \
11. --with-xsl \
12. --with-libxml-dir \
13. --enable-ftp \
14. --with-gd \
15. --with-freetype-dir \
16. --with-jpeg-dir \
17. --with-png-dir \
18. --enable-mbstring \
19. --with-zlib \
20. --enable-shared \
21. --with-mysql \
22. --enable-fastcgi \
23. --enable-fpm
24. ./configure && make && make install
修改php-fpm的配置文件/usr/local/etc/php-fpm.conf,设置执行php-fpm的用户和组名:
大约在第62行:
1. Unix user of processes
2.
3. Unix group of processes
4.
修改为:
1. Unix user of processes
2.
3. Unix group of processes
4.
启动php-fpm:
1. /usr/local/sbin/php-fpm start
2. lsof -i:9000
3. netstat -ant|grep 9000
4. #9000为php-fpm的默认端口,可以在/usr/local/etc/php-fpm.conf中修改。
修改nginx配置文件/usr/local/nginx/conf/nginx.conf,我的nginx配置文件如下:
1. worker_processes 10;
2. events {
3. worker_connections 1024;
4. }
5. http {
6. include mime.types;
7. default_type application/octet-stream;
8. sendfile on;
9. keepalive_timeout 65;
10. gzip on;
11. server {
12. listen 80;
13. server_name ead;
14. root /data/faceshow/www;
15. location / {
16. root html;
17. index index.php index.html index.htm;
18. }
19. error_page 500 502 503 504 /50x.html;
20. location = /50x.html {
21. root html;
22. }
23.
24. #此段代码为关键
25. location ~ \.php$ {
26. fastcgi_pass 127.0.0.1:9000; #对应php-fmp的端口
27. fastcgi_index index.php;
28. fastcgi_param SCRIPT_FILENAME /data/faceshow/www/$fastcgi_script_name;
29. #php文件的物理路径
30. include fastcgi_params;
31. }
32.
33. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
34. {
35. expires 30d;
36. }
37. location ~ .*\.(js|css)?$
38. {
39. expires 1h;
40. }
41. }
42. }
43.
启动nginx:
1. /usr/local/nginx/bin/nginx
2. /usr/local/nginx/bin/nginx -s reload
三、常见问题:
问题:nginx ./configure时报如下错误
1. ./configure: error: the HTTP rewrite module requires the PCRE library.
2. You can either disable the module by using --without-http_rewrite_module
3. option, or install the PCRE library into the system, or build the PCRE library
4. statically from the source with nginx by using --with-pcre=
解决:这是由于未PCRE库,请安装PCRE库在运行./configure。也可以使用带--without-http_rewrite_module参数进行./configure,但是这将导致nginx不支持rewrite功能!
四、相关文件下载地址:
libcurl: http://curl.haxx.se/download.html
libxml2:ftp://xmlsoft.org/libxml2/
libxslt:ftp://xmlsoft.org/libxml2/
libpng:http://www.libpng.org/pub/png/libpng.html
libjpeg: http://ijg.org/files/
freetype:http://download.savannah.gnu.org/releases/freetype/
pcre:http://www.pcre.org/
nginx:http://nginx.org/en/download.html
php-fpm:http://php-fpm.org/
php5:http://www.php.net/releases/
MySQL:http://www.mysql.com/downloads/mirror.php?id=404683#mirrors
摘自 爱E族

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック











多くのユーザーにとって、Android TV ボックスをハッキングするのは気が遠くなるように思えます。しかし、開発者の Murray R. Van Luyn は、Broadcom チップが不足する中、Raspberry Pi に代わる適切な代替品を探すという課題に直面しました。アルムビアとの共同作業

DeepSeekは、Webバージョンと公式Webサイトの2つのアクセス方法を提供する強力なインテリジェント検索および分析ツールです。 Webバージョンは便利で効率的であり、公式ウェブサイトは包括的な製品情報、ダウンロードリソース、サポートサービスを提供できます。個人であろうと企業ユーザーであろうと、DeepSeekを通じて大規模なデータを簡単に取得および分析して、仕事の効率を向上させ、意思決定を支援し、イノベーションを促進することができます。

DeepSeekをインストールするには、Dockerコンテナ(最も便利な場合は、互換性について心配する必要はありません)を使用して、事前コンパイルパッケージ(Windowsユーザー向け)を使用してソースからコンパイル(経験豊富な開発者向け)を含む多くの方法があります。公式文書は慎重に文書化され、不必要なトラブルを避けるために完全に準備します。

BitPie Bitpie ウォレット アプリをダウンロードするにはどうすればよいですか?手順は次のとおりです。 AppStore (Apple デバイス) または Google Play ストア (Android デバイス) で「BitPie Bitpie Wallet」を検索します。 「入手」または「インストール」ボタンをクリックしてアプリをダウンロードします。コンピューター版の場合は、BitPie ウォレットの公式 Web サイトにアクセスし、対応するソフトウェア パッケージをダウンロードしてください。

Bitgetは、スポット取引、契約取引、デリバティブなど、さまざまな取引サービスを提供する暗号通貨交換です。 2018年に設立されたこのExchangeは、シンガポールに本社を置き、安全で信頼性の高い取引プラットフォームをユーザーに提供することに取り組んでいます。 Bitgetは、BTC/USDT、ETH/USDT、XRP/USDTなど、さまざまな取引ペアを提供しています。さらに、この取引所はセキュリティと流動性について評判があり、プレミアム注文タイプ、レバレッジド取引、24時間年中無休のカスタマーサポートなど、さまざまな機能を提供します。

システム変数 $n は、スクリプトまたは関数に渡されるパラメータです。 nはパラメータの数を示す数字です。たとえば、最初のパラメータは $1、2 番目のパラメータは $2$ です? 前のコマンドの終了ステータス、または関数の戻り値。成功した場合は 0、失敗した場合は 1 を返します $#スクリプトまたは関数に渡されるパラメータの数 $* これらのパラメータはすべて二重引用符で囲まれます。スクリプトが 2 つのパラメータを受け取る場合、$* は $1$2$0 実行されるコマンドの名前と等しくなります。シェル スクリプトの場合、$@ が二重引用符 ("") で囲まれている場合、これは起動されたコマンドへのパスになります。$* とは少し異なります。スクリプトが 2 つのパラメータを受け取る場合、$@ は現在のシェルのプロセス番号である $1$2$$ に相当します。シェルスクリプトの場合、これは実行時のプロセスです。

1. インストール環境 (Hyper-V 仮想マシン): $hostnamectlStatichostname:localhost.localdomainIconname:computer-vmChassis:vmMachineID:renwoles1d8743989a40cb81db696400BootID:renwoles272f4aa59935dcdd0d456501Virtualization:microsoftOperatingSystem:CentOS Linux7(Core)CPEOSName: CP:

世界をリードするデジタル資産交換であるOuyi Okxは、安全で便利な取引体験を提供するために、公式のインストールパッケージを開始しました。 OUYIのOKXインストールパッケージは、ブラウザに直接インストールでき、ユーザー向けの安定した効率的な取引プラットフォームを作成できます。インストールプロセスは、簡単で理解しやすいです。
