Linux安装Nginx
程序员文章站
2022-09-03 09:50:59
CentOS 通过yum指令安装nginx 1.创建nginx安装来源 将$releasever替换为7,将$basearch替换成x86_64,这两个指令可以自动获取系统属性。 2.安装 3.启动 4.本地测试是否启动服务 Ubuntu 通过apt-get安装Nginx 1.卸载默认安装 2.安装 ......
CentOS 通过yum指令安装nginx
1.创建nginx安装来源
vi /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/x86_64/ gpgcheck=0 enabled=1
将$releasever替换为7,将$basearch替换成x86_64,这两个指令可以自动获取系统属性。
rpm -qa | grep centos-release
2.安装
yum install nginx
3.启动
service nginx start
4.本地测试是否启动服务
curl -i localhost
Ubuntu 通过apt-get安装Nginx
1.卸载默认安装
sudo apt-get remove nginx
2.安装
sudo apt-get install software-properties-common sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get install nginx
3.启动
service nginx start
4.本地测试是否启动服务
curl -i localhost
Nginx常用指令:
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configuration and exit -T : test configuration, dump it and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /usr/share/nginx/) -c filename : set configuration file (default: /etc/nginx/nginx.conf) -g directives : set global directives out of configuration file
上一篇: 不知道会扇得手疼吗
下一篇: php eval函数用法总结