稳定性高
系统资源消耗低
对HTTP并发连接的处理能力高
[root@localhost ~]# smbclient -L //192.168.100.50/
Enter SAMBA\root's password:
OS=[Windows 10 Enterprise LTSC 2019 17763] Server=[Windows 10 Enterprise LTSC 2019 6.3]
Sharename Type Comment
--------- ---- -------
IPC$ IPC 远程 IPC
share Disk
tools Disk
Users Disk
Connection to 192.168.100.50 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available
[root@localhost ~]# mkdir /mnt/tools
[root@localhost ~]# mount.cifs //192.168.100.50/tools /mnt/tools/
Password for root@//192.168.100.50/tools:
[root@localhost ~]# cd /mnt/tools/
[root@localhost tools]# ls
awstats-7.6.tar.gz extundelete-0.2.4.tar.bz2 forbid.png jdk-8u191-windows-x64.zip LAMP-C7 picture.jpg
cronolog-1.6.2-14.el7.x86_64.rpm fiddler.exe intellijideahahau2018.rar john-1.8.0.tar.gz LNMP
[root@localhost tools]#
[root@localhost tools]# cd LNMP/
[root@localhost LNMP]# ls
Discuz_X3.4_SC_UTF8.zip mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz php-7.1.20.tar.gz
[root@localhost LNMP]# tar zxvf nginx-1.12.2.tar.gz -C /opt/
.......//省略解压过程
[root@localhost LNMP]# yum -y install gcc gcc-c++ pcre-devel zlib-devel
........//省略安装过程
[root@localhost LNMP]#
[root@localhost LNMP]# useradd -M -s /sbin/nologin nginx //-M,不创建家目录
[root@localhost LNMP]# id nginx //查看nginx用户
uid=1001(nginx) gid=1001(nginx) 组=1001(nginx)
[root@localhost LNMP]#
[root@localhost LNMP]# cd /opt/nginx-1.12.2/
[root@localhost nginx-1.12.2]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@localhost nginx-1.12.2]# ./configure \
> --prefix=/usr/local/nginx \ //安装路径
> --user=nginx \ //属主
> --group=nginx \ //属组
> --with-http_stub_status_module //开启统计模块
........//省略配置过程
[root@localhost nginx-1.12.2]# make && make install
.........//省略编译过程
[root@localhost nginx-1.12.2]#
[root@localhost nginx-1.12.2]# cd /usr/local/nginx/
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
[root@localhost sbin]#
[root@localhost sbin]# nginx -t //检查测试配置文件
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost sbin]# nginx //开启服务
[root@localhost sbin]# netstat -ntap | grep 80 //查看80端口
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 52709/nginx: master
[root@localhost sbin]#
[root@localhost sbin]# systemctl stop firewalld.service //关闭防火墙
[root@localhost sbin]# setenforce 0 //关闭增强性安全功能
[root@localhost sbin]#
[root@localhost sbin]# yum install elinks -y //安装工具
.........//省略安装过程
[root@localhost sbin]#
[root@localhost sbin]# elinks http://localhost //测试能否访问nginx服务
[root@localhost sbin]# killall -s QUIT nginx //停止服务
[root@localhost sbin]# killall -3 nginx //停止服务
[root@localhost sbin]# killall -s HUP nginx //重载服务
[root@localhost sbin]# killall -1 nginx //重载服务
[root@localhost sbin]# nginx //启动服务
[root@localhost sbin]# vim /etc/init.d/nginx
#!/bin/bash
# chkconfig: - 99 20
# description: Nginx Service Control Script
PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case "$1" in
start)
$PROG
;;
stop)
kill -s QUIT $(cat $PIDF)
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIDF)
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0
[root@localhost sbin]# chmod +x /etc/init.d/nginx //添加执行权限
[root@localhost sbin]# chkconfig --add nginx //添加让系统可以识别
[root@localhost sbin]#
[root@localhost sbin]# service nginx stop //停止服务
[root@localhost sbin]# netstat -ntap | grep 80 //查看80端口,无
[root@localhost sbin]# service nginx start //开启服务
[root@localhost sbin]# netstat -ntap | grep 80 //查看80端口,有
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 53614/nginx: master
[root@localhost sbin]#
[root@localhost sbin]# vim /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm;
}
location /status {
stub_status on;
access_log off;
}
[root@localhost sbin]# service nginx stop
[root@localhost sbin]# service nginx start
[root@localhost sbin]#
[root@localhost sbin]# vim /usr/local/nginx/conf/nginx.conf
location / {
auth_basic "secret";
auth_basic_user_file /usr/local/nginx/passwd.db;
root html;
index index.html index.htm;
}
location /status {
stub_status on;
access_log off;
}
[root@localhost sbin]#
[root@localhost sbin]# yum install httpd-tools -y
........//省略安装过程
[root@localhost sbin]#
[root@localhost sbin]# htpasswd -c /usr/local/nginx/passwd.db test
New password:
Re-type new password:
Adding password for user test
[root@localhost sbin]# cat /usr/local/nginx/passwd.db
test:$apr1$od5a34WH$MduYUJbQ2W0oihB0Bs/bx.
[root@localhost sbin]#
[root@localhost sbin]# service nginx stop
[root@localhost sbin]# service nginx start
[root@localhost sbin]#
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。