### nginx Document
https://nginx.org/en/docs/
### nginx install
https://nginx.org/en/docs/install.html
## nginx package install
https://nginx.org/en/linux_packages.html
# vender 별 지원되는 패키지 입니다.
RHEL/CentOS:
Version Supported Platforms
6.x x86_64, i386
7.x x86_64, ppc64le
Debian:
Version Codename Supported Platforms
7.x wheezy x86_64, i386
8.x jessie x86_64, i386
9.x stretch x86_64, i386
Ubuntu:
Version Codename Supported Platforms
12.04 precise x86_64, i386
14.04 trusty x86_64, i386, aarch64/arm64
16.04 xenial x86_64, i386, ppc64el, aarch64/arm64
16.10 yakkety x86_64, i386
SLES:
Version Supported Platforms
12 x86_64
# vender 별 저장소 만들기
- RHEL, Centos
/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
ㄴ “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions 으로 설정해서 사용합니다.
- Debian/Ubuntu
sudo apt-key add nginx_signing.key
ㄴ PGP Key 설치 작업을 선행합니다.
deb http://nginx.org/packages/debian/ codename nginx
deb-src http://nginx.org/packages/debian/ codename nginx
ㄴ Debian 에서 설치 방법 입니다.
deb http://nginx.org/packages/ubuntu/ codename nginx
deb-src http://nginx.org/packages/ubuntu/ codename nginx
ㄴ Ubuntu 에서 설치 방법 입니다.
apt-get update
apt-get install nginx
ㄴ apt-get 을 통해서 설치가 가능합니다.
- SLES (Suse Linux)
zypper addrepo -G -t yum -c 'http://nginx.org/packages/sles/12' nginx
## Amazon Linux Package install
[root@ip-10-90-10-49 ~]# yum install nginx
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.3 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.1-1.32.amzn1 will be installed
--> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.12.1-1.32.amzn1.x86_64
--> Running transaction check
---> Package gperftools-libs.x86_64 0:2.0-11.5.amzn1 will be installed
--> Processing Dependency: libunwind.so.8()(64bit) for package: gperftools-libs-2.0-11.5.amzn1.x86_64
--> Running transaction check
---> Package libunwind.x86_64 0:1.1-10.8.amzn1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
nginx x86_64 1:1.12.1-1.32.amzn1 amzn-updates 561 k
Installing for dependencies:
gperftools-libs x86_64 2.0-11.5.amzn1 amzn-main 570 k
libunwind x86_64 1.1-10.8.amzn1 amzn-main 72 k
Transaction Summary
=====================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 1.2 M
Installed size: 2.9 M
Is this ok [y/d/N]:
[root@ip-10-90-10-49 ~]# rpm -qa | grep nginx
nginx-1.12.1-1.32.amzn1.x86_64
[root@ip-10-90-10-49 ~]#
[root@ip-10-90-10-49 ~]# /etc/init.d/nginx start
Starting nginx: [ OK ]
[root@ip-10-90-10-49 ~]# netstat -lpn | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 11184/nginx
tcp 0 0 :::80 :::* LISTEN 11184/nginx
[root@ip-10-90-10-49 ~]#
## RHEL nginx install
[root@ip-10-90-10-54 ~]# yum install nginx
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package nginx available.
Error: Nothing to do
[root@ip-10-90-10-54 ~]#
설치를 해보면 해당 패키지를 찾을수 없다고 나옵니다.
NGINX 저장소를 추가 해주는 작업을 합니다.
cat << EOF > /etc/yum.repos.d/nginx.repo
[nginx]
name=Nginx Repository \$basearch - Archive
baseurl=http://nginx.org/packages/rhel/7/\$basearch/
enabled=1
gpgcheck=0
EOF
[root@ip-10-90-10-54 ~]# yum install nginx
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
nginx | 2.9 kB 00:00:00
rhui-REGION-client-config-server-7 | 2.9 kB 00:00:00
rhui-REGION-rhel-server-releases | 3.5 kB 00:00:00
rhui-REGION-rhel-server-rh-common | 3.8 kB 00:00:00
(1/8): nginx/x86_64/primary_db | 27 kB 00:00:00
(2/8): rhui-REGION-client-config-server-7/x86_64/primary_db | 2.5 kB 00:00:04
(3/8): rhui-REGION-rhel-server-releases/7Server/x86_64/primary_db | 43 MB 00:00:06
(4/8): rhui-REGION-rhel-server-releases/7Server/x86_64/updateinfo | 2.3 MB 00:00:11
(5/8): rhui-REGION-rhel-server-rh-common/7Server/x86_64/updateinfo | 32 kB 00:00:07
(6/8): rhui-REGION-rhel-server-releases/7Server/x86_64/group | 709 kB 00:00:13
(7/8): rhui-REGION-rhel-server-rh-common/7Server/x86_64/group | 104 B 00:00:15
(8/8): rhui-REGION-rhel-server-rh-common/7Server/x86_64/primary_db | 119 kB 00:00:14
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.1-1.el7.ngx will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================
Installing:
nginx x86_64 1:1.12.1-1.el7.ngx nginx 716 k
Transaction Summary
============================================================================================================================================
Install 1 Package
Total download size: 716 k
Installed size: 2.5 M
Is this ok [y/d/N]:
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
Verifying : 1:nginx-1.12.1-1.el7.ngx.x86_64 1/1
Installed:
nginx.x86_64 1:1.12.1-1.el7.ngx
Complete!
[root@ip-10-90-10-54 ~]#
[root@ip-10-90-10-54 ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@ip-10-90-10-54 ~]# systemctl start nginx
[root@ip-10-90-10-54 ~]# netstat -lpn | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1151/nginx: master
[root@ip-10-90-10-54 ~]#
## Ubuntu nginx install
root@ip-10-90-10-130:~# apt install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
guile-2.0-libs libgc1c2 libgsasl7 libkyotocabinet16v5 liblockfile-bin
liblockfile1 libltdl7 libmailutils4 libmysqlclient20 libntlm0 libpython2.7
libpython2.7-minimal libpython2.7-stdlib libunistring0 mailutils-common
mysql-common sendmail-base
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libtiff5 libvpx3 libxpm4 libxslt1.1 nginx-common
nginx-core
Suggested packages:
libgd-tools fcgiwrap nginx-doc
The following NEW packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libtiff5 libvpx3 libxpm4 libxslt1.1 nginx
nginx-common nginx-core
0 upgraded, 14 newly installed, 0 to remove and 35 not upgraded.
Need to get 3,000 kB of archives.
After this operation, 9,783 kB of additional disk space will be used.
Do you want to continue? [Y/n]
root@ip-10-90-10-130:~# /etc/init.d/nginx start
[ ok ] Starting nginx (via systemctl): nginx.service.
root@ip-10-90-10-130:~#
## Suse nginx install
ip-10-90-10-249:~ # zypper install nginx
Refreshing service 'SMT-http_smt-ec2_susecloud_net'.
Refreshing service 'cloud_update'.
Retrieving repository 'SLE-Module-Public-Cloud12-Updates' metadata .......[done]
Building repository 'SLE-Module-Public-Cloud12-Updates' cache ............[done]
Retrieving repository 'SLE-Module-Web-Scripting12-Updates' metadata ......[done]
Building repository 'SLE-Module-Web-Scripting12-Updates' cache ...........[done]
Retrieving repository 'SLE-SDK12-SP2-Updates' metadata ...................[done]
Building repository 'SLE-SDK12-SP2-Updates' cache ........................[done]
Retrieving repository 'SLES12-SP2-Updates' metadata ......................[done]
Building repository 'SLES12-SP2-Updates' cache ....................................................................................................[done]
Loading repository data...
Reading installed packages...
'nginx' not found in package names. Trying capabilities.
No provider of 'nginx' found.
Resolving package dependencies...
Nothing to do.
ip-10-90-10-249:~ #
ip-10-90-10-249:~ # zypper addrepo -G -t yum -c 'http://nginx.org/packages/sles/12' nginx
Adding repository 'nginx' .........................................................................................................................[done]
Warning: GPG checking is disabled in configuration of repository 'nginx'. Integrity and origin of packages cannot be verified.
Repository 'nginx' successfully added
Enabled : Yes
Autorefresh : No
GPG Check : No
Priority : 99
URI : http://nginx.org/packages/sles/12
ip-10-90-10-249:~ #
ip-10-90-10-249:~ # zypper install nginx
Refreshing service 'SMT-http_smt-ec2_susecloud_net'.
Refreshing service 'cloud_update'.
Building repository 'nginx' cache .................................................................................................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following NEW package is going to be installed:
nginx
The following package is not supported by its vendor:
nginx
1 new package to install.
Overall download size: 635.3 KiB. Already cached: 0 B. After the operation, additional 2.5 MiB will be used.
Continue? [y/n/? shows all options] (y):
Retrieving package nginx-1.12.1-1.sles12.ngx.x86_64 (1/1), 635.3 KiB ( 2.5 MiB unpacked)
Retrieving: nginx-1.12.1-1.sles12.ngx.x86_64.rpm .....................................................................................[done (83.7 KiB/s)]
Checking for file conflicts: ......................................................................................................................[done]
(1/1) Installing: nginx-1.12.1-1.sles12.ngx.x86_64 ................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/nginx/x86_64/RPMS/nginx-1.12.1-1.sles12.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
ip-10-90-10-249:~ #
ip-10-90-10-249:/etc/init.d # systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
ip-10-90-10-249:/etc/init.d # systemctl start nginx
ip-10-90-10-249:/etc/init.d # netstat -lpn | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2808/nginx.conf
ip-10-90-10-249:/etc/init.d #
## 설치 확인
설치된 IP 를 웹브라우저로 확인 합니다.
====================================
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
====================================
위의 메시지가 확인되면 설치 완료 되었습니다.
====================================
Welcome to nginx on the Amazon Linux AMI!
This page is used to test the proper operation of the nginx HTTP server after it has been installed. If you can read this page, it means that the web server installed at this site is working properly.
Website Administrator
This is the default index.html page that is distributed with nginx on the Amazon Linux AMI. It is located in /usr/share/nginx/html.
You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.
[ Powered by nginx ] [ Powered by the Amazon Linux AMI ]
====================================
Amazon Linux 는 조금 다른 이미지로 확인됩니다.
'Web Server > NginX' 카테고리의 다른 글
NginX 설정파일 분석 (0) | 2017.10.31 |
---|