CentOS 7 用 yum 安装 Nginx
来源:互联网 发布:买家怎么开淘宝店 编辑:程序博客网 时间:2024/06/10 05:27
CentOS 7 用 yum 安装 Nginx
在 CentOS 7 中,直接使用 yum 安装 Nignx 会提示无下载源。因此,需要添加 Nginx 的下载源到 yum:
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
指定了下载源后,就可以使用 yum 命令来安装 Nginx 了:
sudo yum install -y nginx
安装完成的 Nginx 并不会立刻启动,需要我们手动执行命令来开启它:
sudo systemctl start nginx.service
还可以输入以下命令,让 Nginx 可以随系统自动启动:
sudo systemctl enable nginx
接下来打开浏览器,访问本地地址 http://localhost 就可以看到 Nginx 的欢迎页面了~
也可以在服务器上输入下面的命令,来查看 Nginx 所在服务器的公共IP地址,然后在客户端浏览器上输入 IP 也是可以访问的:
ip addr
相关补充:
# 开启 Nginxservice nginx start# 停止 Nginxservice nginx stop# 重启 Nginxservice nginx restart# 查看 Nginx 状态service nginx status
Nginx 的默认站点根目录为
/usr/share/nginx/html/
默认站点配置在
/etc/nginx/conf.d/default.conf
Nginx 主配置如下
/etc/nginx/nginx.conf
在这个配置文件里,会用到include
指令,其它地方的配置文件会包含到这个主要的配置文件里,用这种方法可以让配置文件更有条理,也更容易维护。
Tags CentOS, Linux, Nginx, 原创
阅读全文
0 0
- CentOS 7 用 yum 安装 Nginx
- CentOS 7 YUM 安装 Nginx
- CentOS 7 yum 安装 Nginx
- centos 7 yum 安装 NGINX
- centos 7 yum安装 nginx
- CentOS 7 yum 安装 Nginx
- CentOS 7 yum 安装 Nginx
- CentOS 7 yum 安装 Nginx
- CentOS 7 yum 安装 Nginx
- CentOS 7 YUM 安装 Nginx
- CentOS 7 yum 安装 Nginx
- CentOS 7 yum 安装 Nginx
- CentOS 7 YUM 安装 Nginx
- centos yum安装nginx
- CentOS yum 安装 nginx
- Centos yum 安装Nginx
- CentOS yum安装nginx
- CentOS 7 yum安装nginx-1.12.0
- Linux schedule 5、EAS(Energy-Aware Scheduling)
- Linux schedule 6、Cgoup
- linux --> shell --> date,cal,bc,man...
- shadowsocks-manager 实战大全
- linux --> shell --> umask,权限
- CentOS 7 用 yum 安装 Nginx
- Spring配置之OpenSessionInViewFilter
- 解决maven没有打包xml文件
- Mapped Statements collection does not contain value for
- AndroidLocalizationer 支持百度翻译
- 啊啊啊
- Linux schedule (目录)
- 探索Oracle之LogMiner 最佳实践一
- SPSS实例