×

nginx

xueyue8 xueyue8 发表于2019-09-02 15:45:06 浏览738 评论0

抢沙发发表评论

编译安装目录

/usr/local/nginx



启动命令

/usr/local/nginx/sbin/nginx -V

加入到环境变量

echo $PATH

vi /etc/profile

export PATH=$PATH:/usr/local/nginx/sbin

更新一下,否则需要注销,重新进入

source /etc/profile

这样就可以了

nginx -V


启动命令

nginx -h   帮助

nginx -t  检查配置文件是否有错误

nginx   启动服务

nginx -s 

查看进程

ps auxfww|grep nginx

查看占用端口

netstat -tulnp|grep nginx

查看日志

tail -f  /usr/local/nginx/logs/error.log

浏览器查看


使用systemctl管理nginx,

vi /usr/lib/systemd/system/nginx.service


[Unit]

Description=nginx

After=network.target            //网通了,就启动

[Service]

ExecStart=/usr/local/nginx/sbin/nginx

[Install]

WantedBy=muti-user.target        //启动级别。level 3  用runlevel查看


pkill nginx   //杀死该进程


systemctl start nginx          用systemctl启动nginx
















群贤毕至

访客