Nginx源码安装

安装环境:Centos7.6

http://centos.hbcse.tifr.res.in/centos/7.6.1810/isos/x86_64/  

一、安装依赖环境

 yum install -y pcre*

 yum -y install openssl*

二、安装Nginx安装包

创建程序用户

useradd -s /sbin/nologin nginx

创建一个放软件包的位置

wget http://nginx.org/download/nginx-1.14.2.tar.gz

tar -zxvf nginx-1.14.2.tar.gz -C /opt

cd  /opt/nginx-1.14.2

./configure --prefix=/usr/local/nginx \--user=nginx --group=nginx \--with-http_ssl_module

 make && make install       

 vi /etc/init.d/nginx

#!/bin/bash

# chkconfig: 35 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

                                                 //管理脚本

chmod +x /etc/init.d/nginx

chkconfig --add nginx

 ln -s /usr/local/nginx/sbin/nginx /usr/sbin/   

systemctl start nginx

 netstat -tnlp | grep nginx    过滤nginx服务端口

三、给nginx网页弄一个图片 ,太少了水点字数,别踩

       vi /usr/local/nginx/html/index.html

          <html>

           <head>  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>

            <body>

            <h1>GOOD LUCK TO YOU</h1>

           <img src="1.jpg" width = "50%" heigth = "50%" alt="桐谷和人" />

            </body>

            </html>

      yum install -y lrzsz  安一个传文件的命令

      rz   选张图片到 /usr/local/nginx/html

      mv  图片名 1.jpg


       水完了,加油喽 

          

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。