Linux で nginx をインストールして構成する方法
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
Thisエラーが発生します。その場合、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 を実行します。「サーバー ステータス」ページを有効にして、./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/nginx
これは本当に間違ったアドレスです 上記を
#nginx configure export nginx_home=/usr/local/nginx export path=$path:$nginx_home/sbin
に変更します コンパイル後、保存して終了し、
[root@vw010001135067 nginx-1.10.2]# source /etc/profile
を実行して設定を行います効果的。
1.7 nginx バージョンの確認
[root@vw010001135067 nginx]# nginx -v nginx version: nginx/1.10.2
プロセス全体が成功しました。
2. nginx.conf を変更します
2.1 nginx を開始します
設定後の nginx サービスは http://10.1.135.67/ にあります。成功しました。nginx
[root@vw010001135067 nginx]# cd /usr/local/nginx [root@vw010001135067 nginx]# nginx -c conf/nginx.conf
を起動してください。起動が成功しました。ブラウザで http://10.1.135.67/ を開きます。デフォルトのポート番号は 80.
上記のように、nginx はすでに正常に動作しています。
2.2 Tomcat サービスの構成
現在、Tomcat サービスは 10.1.29.15 にあり、nginx 経由で転送する必要があります。次に、nginx.conf を開いて構成ファイルを変更します。次のように追加します:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024;#最大连接数,默认为512 accept_mutex on; #设置网路连接序列化,防止惊群现象发生,默认为on multi_accept on; #设置一个进程是否同时接受多个网络连接,默认为off #use epoll; #事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport } http { #文件扩展名与文件类型映射表 include mime.types; #默认文件类型,默认为text/plain default_type application/octet-stream; #自定义格式 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; #combined为日志格式的默认值 access_log logs/access.log main; #允许sendfile方式传输文件,默认为off,可以在http块,server块,location块 sendfile on; sendfile_max_chunk 100k; #每个进程每次调用传输数量不能大于设定的值,默认为0,即不设上限。 #tcp_nopush on; #连接超时时间,默认为75s,可以在http,server,location块。 keepalive_timeout 65; #gzip on; upstream upload { server 10.1.29.15:8080; } error_page 404 https://www.baidu.com; #错误页 server { keepalive_requests 120; #单连接请求上限次数。 listen 80; #监听端口 server_name localhost; #监听地址 #charset koi8-r; #access_log logs/host.access.log main; location ~ ^.*?/upload/[^/]*?$ { proxy_connect_timeout 15; proxy_send_timeout 15; proxy_read_timeout 15; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header connection ""; proxy_pass http://upload; #请求转向upload 定义的服务器列表 client_max_body_size 1024m; } } }
設定後、設定ファイルを保存してnginxを再起動します
[root@vw010001135067 nginx]# nginx -s reload
アップロード プロジェクトがブラウザで正常に呼び出されるかどうか
# 図に示すように、プロジェクトに正しくアクセスでき、構成は成功しました。
以上がLinux で nginx をインストールして構成する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

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

人気の記事

ホットツール

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

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

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

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

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

ホットトピック











Linuxシステムの5つの基本コンポーネントは次のとおりです。1。Kernel、2。Systemライブラリ、3。Systemユーティリティ、4。グラフィカルユーザーインターフェイス、5。アプリケーション。カーネルはハードウェアリソースを管理し、システムライブラリは事前コンパイルされた機能を提供し、システムユーティリティはシステム管理に使用され、GUIは視覚的な相互作用を提供し、アプリケーションはこれらのコンポーネントを使用して機能を実装します。

gitリポジトリアドレスを表示するには、次の手順を実行します。1。コマンドラインを開き、リポジトリディレクトリに移動します。 2。「git remote -v」コマンドを実行します。 3.出力と対応するアドレスでリポジトリ名を表示します。

NotePadはJavaコードを直接実行することはできませんが、他のツールを使用することで実現できます。コマンドラインコンパイラ(Javac)を使用してByteCodeファイル(filename.class)を生成します。 Javaインタープリター(Java)を使用して、バイトコードを解釈し、コードを実行し、結果を出力します。

Sublimeでコードを実行するには6つの方法があります。ホットキー、メニュー、ビルドシステム、コマンドライン、デフォルトビルドシステムの設定、カスタムビルドコマンド、プロジェクト/ファイルを右クリックして個々のファイル/プロジェクトを実行します。ビルドシステムの可用性は、崇高なテキストのインストールに依存します。

Laravelをインストールするには、これらの手順を順番に進みます。コンポーザー(MacOS/LinuxとWindows用)インストールLaravelインストーラーをインストールします。

GITソフトウェアのインストールには、次の手順が含まれています。インストールパッケージをダウンロードしてインストールパッケージを実行して、インストール構成gitインストールgitバッシュ(Windowsのみ)を確認します

崇高なテキストは、一般的に使用される(保存、コピー、カットなど)、編集(インデント、フォーマットなど)、ナビゲーション(プロジェクトパネル、ファイルブラウジングなど)、ショートカットの検索と交換など、開発効率を改善するためのショートカットを提供します。これらのショートカットキーを使用する習熟度は、Sublimeの効率を大幅に改善できます。

開発環境をカスタマイズするには多くの方法がありますが、グローバルGit構成ファイルは、ユーザー名、電子メール、優先テキストエディター、リモートブランチなどのカスタム設定に使用される可能性が最も高いものです。グローバルGIT構成ファイルについて知っておくべき重要なことは次のとおりです。
