centos7安装nginx
-
下载解压
-
官网地址: nginx: download
-
下载稳定版中的,Linux版本
-
解压缩
tar -zxvf nginx-1.22.1.tar.gz
-
-
安装依赖
yum install -y openssl* & yum -y install ncurses-devel
-
打开解压缩的nginx目录,配置编译
cd /nginx-1.22.1
./configure
make
make install./configure配置的过程中会输出的信息,里面包含配置文件启动文件等信息
nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
-
检查nginx 默认安装路径,如下图安装在 /usr/local/nginx 路径下
whereis nginx
-
cd /usr/local/nginx 这里面可以配置和启动 ngxin
配置文件位于:config/nginx.conf
启动: sbin/nginx
- 建立开机启动文件
vi /etc/systemd/system/nginxd.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
PrivateTmp=true
[Install]
WantedBy=multi-user.target
- 加入开机启动
systemctl enable nginxd
能耍的时候就一定要耍,不能耍的时候一定要学。
--天道酬勤,贵在坚持posted on 2022-12-04 10:48 zhangyukun 阅读(102) 评论(0) 编辑 收藏 举报