1. Linux で nginx をインストールして構成します
初めて nginx をインストールしますが、その過程で発生する問題は段階的に解決されます。
サーバーに接続してログインするために使用されるツールは secureCRT です。
1.1 rz コマンドを実行すると、ダイアログ ボックスが表示され、アップロードする nginx 圧縮パッケージを選択します。
#rz
1.2 解凍します
[root@vw010001135067 ~]# cd /usr/local/ [root@vw010001135067 local]# tar -zvxf nginx-1.10.2.tar.gz
1.3 nginxフォルダーに入り、./configureコマンドを実行します
[root@vw010001135067 local]# cd nginx-1.10.2 [root@vw010001135067 nginx-1.10.2]# ./configure
エラーは次のように報告されます:
checking for OS + Linux 2.6.32-431.el6.x86_64 x86_64 checking for C compiler ... not found ./configure: error: C compiler cc is not found
このエラーが発生します。その場合、gcc パッケージはインストールされません。
1.3.1 gccのインストール
gccの表示
[root@vw010001135067 nginx-1.10.2]# whereis gcc gcc:
gccのインストール
[root@vw010001135067 nginx-1.10.2]# yum -y install gcc
インストールが成功したら、再度
[root@vw010001135067 nginx-1.10.2]# whereis gcc gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
gccがインストールされていることを確認してください。
1.3.2 ./configure
[root@vw010001135067 nginx-1.10.2]# ./configure checking for OS + Linux 2.6.32-431.el6.x86_64 x86_64 checking for C compiler ... found ...... checking for PCRE library ... not found checking for PCRE library in /usr/local/ ... not found checking for PCRE library in /usr/include/pcre/ ... not found checking for PCRE library in /usr/pkg/ ... not found checking for PCRE library in /opt/local/ ... not found ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
を実行し続けると上記のエラーが発生します。 pcre-devel をインストールします
[root@vw010001135067 nginx-1.10.2]# yum install pcre-devel
1.3.3 ./configure を再度実行します
error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option.
このエラーがある場合は、実行してください
yum install zlib-devel
1.3.4 ./configure
[root@vw010001135067 nginx-1.10.2]# ./configure checking for OS + Linux 2.6.32-431.el6.x86_64 x86_64 checking for C compiler ... found + using GNU C compiler + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ....... Configuration summary + using system PCRE library + OpenSSL library is not used + md5: using system crypto library + sha1: using system crypto library + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"を実行してもエラーは報告されません
1.4 openssl機能、sha1機能を使用したい場合。 次に openssl をインストールし、sha1
[root@vw010001135067 nginx-1.10.2]# yum install openssl openssl-devel [root@vw010001135067 nginx-1.10.2]# install perl-Digest-SHA1.x86_64
1.4.1 ssl モジュールの実行を有効にします。/configure –with-http_ssl_module
[root@vw010001135067 nginx-1.10.2]# ./configure --with-http_ssl_module
1.4.2 「server+status」ページを有効にして実行します。/configure –with-http_stub_status_module
[root@vw010001135067 nginx-1.10.2]# ./configure --with-http_stub_status_module
上記2つのコマンドは同時に起動可能です
[root@vw010001135067 nginx-1.10.2]# ./configure --with-http_stub_status_module --with-http_ssl_module
1.5 上記configureは通過しました
makeコマンドを実行し、make installコマンドを実行します
[root@vw010001135067 nginx-1.10.2]# make [root@vw010001135067 nginx-1.10.2]# make install
この時点でnginxが実行されています成功しました
1.6 環境変数を設定します
で /etc/profile に設定を追加します
設定ファイルを開きます
[root@vw010001135067 nginx-1.10.2]# vi /etc/profile
設定ファイルに
#nginx configure export NGINX_HOME=/usr/local/nginx-1.10.2 export PATH=$PATH:$NGINX_HOME/sbin
を追加します
上記のように入力し始めました、しかし、nginx -vを使用すると見つかりませんでした。上記の nginx_home 設定のアドレスが間違っていることに気付きました。まずnginxのインストールアドレスを探します
[root@vw010001135067 nginx-1.10.2]# whereis nginx nginx: /usr/local/nginxE
は実際には間違ったアドレスです。 上記をコンパイルして保存して実行するには
#nginx configure export NGINX_HOME=/usr/local/nginx export PATH=$PATH:$NGINX_HOME/sbin
[root@vw010001135067 nginx-1.10.2]# source /etc/profileプロセス全体が成功しました! 2. nginx.conf を変更します2.1 nginx を起動します私の nginx サービスは http://10.1.135.67/ にあります。起動に成功したら、nginx を起動します
ブラウザ内: //10.1.135.67/、デフォルトのポート番号は 80 です。
上の図に示すように、nginx は正常に動作しています。
2.2 Tomcat サービスを構成する
今、私の Tomcat サービスは 10.1.29.15 にあり、nginx 経由で転送する必要があります。次に、nginx.conf を開いて構成ファイルを変更します。以下のように追加します:
[root@vw010001135067 nginx]# nginx -v nginx version: nginx/1.10.2
設定後、設定ファイルを保存し、nginxを再起動します
[root@vw010001135067 nginx]# cd /usr/local/nginx [root@vw010001135067 nginx]# nginx -c conf/nginx.conf
ブラウザでアップロードプロジェクトを呼び出して、成功したかどうかを確認します
図に示すように、次のことができますプロジェクトに正しくアクセスでき、設定は成功しました。
以上がこの記事の全内容です。皆さんの学習に役立つことを願っています。また、皆さんも PHP 中国語 Web サイトをサポートしていただければ幸いです。
Linux での nginx のインストールと構成に関する詳細な記事については、PHP 中国語 Web サイトに注目してください。

phpssionsStrackuserdataacrossmultiplepagerequestsusingauniqueidstoredinacookie.here'showtomanageetheemefectively:1)Startassession withsession_start()andstoredatain $ _ session.2)RegeneratesseSsessidafterloginwithsession_id(the topreventes_id)

PHPでは、次の手順を通じてセッションデータを繰り返すことができます。1。session_start()を使用してセッションを開始します。 2。$ _Sessionアレイのすべてのキー価値ペアを介してforeachループを反復します。 3.複雑なデータ構造を処理する場合、is_array()またはis_object()関数を使用し、print_r()を使用して詳細情報を出力します。 4.トラバーサルを最適化する場合、ページングを使用して、一度に大量のデータの処理を避けることができます。これにより、実際のプロジェクトでPHPセッションデータをより効率的に管理および使用するのに役立ちます。

このセッションは、サーバー側の状態管理メカニズムを介してユーザー認証を実現します。 1)セッションの作成と一意のIDの生成、2)IDはCookieを介して渡されます。3)サーバーストアとIDを介してセッションデータにアクセスします。

tostoreauser'snameInappession、starthessession withsession_start()、thensignthenameto $ _session ['username']。1)ousession_start()toinitializethessession.2)assighttheuser'snameto $ _ session ['username']

PHPSESSIONの障害の理由には、構成エラー、Cookieの問題、セッションの有効期限が含まれます。 1。構成エラー:正しいセッションをチェックして設定します。save_path。 2.Cookieの問題:Cookieが正しく設定されていることを確認してください。 3.セッションの有効期限:セッションを調整してください。GC_MAXLIFETIME値はセッション時間を延長します。

PHPでセッションの問題をデバッグする方法は次のとおりです。1。セッションが正しく開始されるかどうかを確認します。 2.セッションIDの配信を確認します。 3.セッションデータのストレージと読み取りを確認します。 4.サーバーの構成を確認します。セッションIDとデータを出力し、セッションファイルのコンテンツを表示するなど、セッション関連の問題を効果的に診断して解決できます。

session_start()への複数の呼び出しにより、警告メッセージと可能なデータ上書きが行われます。 1)PHPは警告を発し、セッションが開始されたことを促します。 2)セッションデータの予期しない上書きを引き起こす可能性があります。 3)session_status()を使用してセッションステータスを確認して、繰り返しの呼び出しを避けます。

PHPでのセッションライフサイクルの構成は、session.gc_maxlifetimeとsession.cookie_lifetimeを設定することで達成できます。 1)session.gc_maxlifetimeサーバー側のセッションデータのサバイバル時間を制御します。 0に設定すると、ブラウザが閉じているとCookieが期限切れになります。


ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 英語版
推奨: Win バージョン、コードプロンプトをサポート!

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

WebStorm Mac版
便利なJavaScript開発ツール

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

ホットトピック









