nginx 1.16-0インストール
3520 ワード
nginx linuxバージョンのダウンロードアドレス:
wgetコマンドを実行してnginxをダウンロードする
インストールパッケージを解凍し、tar zxvf nginx-1.16.0.tar.gzを実行してnginxの解凍ディレクトリの下cd nginx-1.16.0に移動ディレクトリの下で./configureコマンドを実行中に./configure:error:the HTTP rewrite module requires the PCRE libraryエラーが発生した場合
yum install-y pcre-develのインストールが完了したら再実行./configure
次のように表示されます.
yum-y install gcc gcc-c++autoconf automakeの実行
出現:./configure:error:the HTTP gzip module requires the zlib library.yum install-y zlib-develを実行
インストールが完了したら、nginxのインストールディレクトリを表示し、whereis nginxからnginxディレクトリの下で-tコマンドを実行し、nginxがインストールに成功したかどうかをテストします.
nginxの起動
ていし
再起動
psaux|grep nginxコマンドでnginxプロセス情報を表示netstat–nltpコマンドでnginxリスニングのポートを表示nginxのプロファイルを編集し、ipアドレスをプロファイルにマッピングして、ホストがipを通じてnginxサイトにアクセスして実行できることを保証する
IP構成を追加nginxコマンドの使用のためにbinディレクトリの下にソフトリンク実行を作成できます.
nginx–vを直接実行すれば
http://nginx.org/download/nginx-1.16.0.tar.gz
wgetコマンドを実行してnginxをダウンロードする
wget http://nginx.org/download/nginx-1.16.0.tar.gz
インストールパッケージを解凍し、tar zxvf nginx-1.16.0.tar.gzを実行してnginxの解凍ディレクトリの下cd nginx-1.16.0に移動ディレクトリの下で./configureコマンドを実行中に./configure:error:the HTTP rewrite module requires the PCRE libraryエラーが発生した場合
yum install-y pcre-develのインストールが完了したら再実行./configure
次のように表示されます.
checking for OS
+ Linux 3.10.0-229.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
yum-y install gcc gcc-c++autoconf automakeの実行
出現:./configure:error:the HTTP gzip module requires the zlib library.yum install-y zlib-develを実行
make
make install
インストールが完了したら、nginxのインストールディレクトリを表示し、whereis nginxからnginxディレクトリの下で-tコマンドを実行し、nginxがインストールに成功したかどうかをテストします.
/usr/local/nginx/sbin/nginx -t
nginxの起動
cd /usr/local/nginx/sbin
./nginx
ていし
./nginx -s stop
再起動
./nginx-s reload
psaux|grep nginxコマンドでnginxプロセス情報を表示netstat–nltpコマンドでnginxリスニングのポートを表示nginxのプロファイルを編集し、ipアドレスをプロファイルにマッピングして、ホストがipを通じてnginxサイトにアクセスして実行できることを保証する
vi /usr/local/nginx/conf/nginx.conf
IP構成を追加nginxコマンドの使用のためにbinディレクトリの下にソフトリンク実行を作成できます.
ln -s /usr/local/nginx/sbin/nginx /bin/nginx
nginx–vを直接実行すれば