如果您使用的是 AWS Linux2,則必須從 AWS“Extras Repository”安裝 nginx。要檢視可用包的列表:
# View list of packages to install
amazon-linux-extras list
您會看到類似於以下內容的列表:
0 ansible2 disabled [ =2.4.2 ]
1 emacs disabled [ =25.3 ]
2 memcached1.5 disabled [ =1.5.1 ]
3 nginx1.12 disabled [ =1.12.2 ]
4 postgresql9.6 disabled [ =9.6.6 ]
5 python3 disabled [ =3.6.2 ]
6 redis4.0 disabled [ =4.0.5 ]
7 R3.4 disabled [ =3.4.3 ]
8 rust1 disabled [ =1.22.1 ]
9 vim disabled [ =8.0 ]
10 golang1.9 disabled [ =1.9.2 ]
11 ruby2.4 disabled [ =2.4.2 ]
12 nano disabled [ =2.9.1 ]
13 php7.2 disabled [ =7.2.0 ]
14 lamp-mariadb10.2-php7.2 disabled [ =10.2.10_7.2.0 ]
使用amazon-linux-extras install
命令安裝它,例如:
sudo amazon-linux-extras install nginx1.12
更多細節在這裡: https: //aws.amazon.com/amazon-linux-2/faqs/。