首页 > 分享 > liunx安装nginx

liunx安装nginx

liunx安装nginx

最新推荐文章于 2022-09-30 18:56:06 发布

花儿为何那样红 于 2018-06-29 16:17:00 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

参考 https://blog.csdn.net/dyllove98/article/details/41120789

1,去官网下载最新的包

官网地址:http://nginx.org/download/

也可以直接 wget http://nginx.org/download/nginx-1.9.9.tar.gz (我这下载很慢所有直接去官网下,在上传到服务器)

2,下载相关依赖包

[root@localhost src] wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz [root@localhost src] tar zxvf pcre-8.40.tar.gz [root@localhost src] cd pcre-8.40 [root@localhost pcre-8.40]# ./configure && make && make install 下面两个安装步骤和上面的一致 [root@localhost src] wget http://zlib.net/zlib-1.2.11.tar.gz [root@localhost src] wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz

3,解压nginx

tar zxvf nginx-1.9.9.tar.gz

cd nginx-1.9.9/

./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module

4,编译nginx

  make && make install

添加一个nginx主程序的符号链接 
ln -sf /usr/local/nginx/sbin/nginx  /usr/sbin

检查配置是否正常

nginx -t 

首先把原来的配置文件清空:

> /usr/local/nginx/conf/nginx.conf

“>” 这个符号之前阿铭介绍过,为重定向的意思,单独用它,可以把一个文本文档快速清空。

vim /usr/local/nginx/conf/nginx.conf

写入如下内容:

user nobody nobody;

worker_processes 2;

error_log /usr/local/nginx/logs/nginx_error.log crit;

pid /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 51200;

events

{

use epoll;

worker_connections 6000;

}

http

{

include mime.types;

default_type application/octet-stream;

server_names_hash_bucket_size 3526;

server_names_hash_max_size 4096;

log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'

'$host "$request_uri" $status'

'"$http_referer" "$http_user_agent"';

sendfile on;

tcp_nopush on;

keepalive_timeout 30;

client_header_timeout 3m;

client_body_timeout 3m;

send_timeout 3m;

connection_pool_size 256;

client_header_buffer_size 1k;

large_client_header_buffers 8 4k;

request_pool_size 4k;

output_buffers 4 32k;

postpone_output 1460;

client_max_body_size 10m;

client_body_buffer_size 256k;

client_body_temp_path /usr/local/nginx/client_body_temp;

proxy_temp_path /usr/local/nginx/proxy_temp;

fastcgi_temp_path /usr/local/nginx/fastcgi_temp;

fastcgi_intercept_errors on;

tcp_nodelay on;

gzip on;

gzip_min_length 1k;

gzip_buffers 4 8k;

gzip_comp_level 5;

gzip_http_version 1.1;

gzip_types text/plain application/x-javascript text/css text/htm application/xml;

server

{

listen 80;

server_name localhost;

index index.html index.htm index.php;

root /usr/local/nginx/html;

location ~ .php$ {

include fastcgi_params;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

}

}

}

5,启动nginx

  /usr/local/nginx/sbin/nginx

  在检查下配置

  nginx -t

  查看nginx 是否启动

  ps -ef | grep nginx

6,测试

 php安装参考 : https://www.cnblogs.com/chancy/p/9238149.html

vim /usr/local/nginx/html/index.php

内容如下:

<?php     echo phpinfo(); ?>

相关知识

nginx lua的笔记
蚂蚁聚合支付系统源码完美版+附安装教程
一个演员扮演两个不同的角色
Centos7上搭建PHP开发环境
盘点自然界十大怪异昆虫:茸毒蛾和魔花螳螂
动物王国九大伪装高手 叶虫:变成一片树叶
搭上春天末班车 花卉大片拍摄技巧分享
又到拍花时 九款经典专用微距镜头选购
MySQL绿色版安装【一键安装脚本】
池州防腐木安装

网址: liunx安装nginx https://m.huajiangbk.com/newsview641005.html

所属分类:花卉
上一篇: 鲜花分类算法
下一篇: 加密算法