[随笔][Tools][在Debian9上安装Nginx]

  • 配置信息:

    操作系统 Linux debian 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

安装ssh(不是必须,是为了使用xshell等客户端工具连接到服务器)

  • 修改源。源的配置文件为/etc/apt/source.list。使用下面的内容替换该文件内的所有内容。
deb http://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
  • 更新源信息
apt-get update
  • 安装ssh server
apt-get install openssh-server
  • 配置ssh允许root用户登陆
vi /etc/ssh/sshd_conf
PermitRootLogin yes
  • 重启ssh
/etc/init.d/ssh restart

安装Nginx

  • 下载nginx的源码,nginx的官方网站下载页面是http://nginx.org/en/download.html。
wget http://nginx.org/download/nginx-1.15.1.tar.gz
tar -zxvf nginx-1.15.1.tar.gz
  • 进入到nginx的源文件目录,调用configure脚本进行配置。configure脚本会收集操作系统的信息以及用户传递的参数,最后生成一个Makefile。
  • 编译,安装。

其他

  • nginx默认的安装目录是/usr/local/nginx。

猜你喜欢

转载自www.cnblogs.com/person3/p/11721863.html