CentOS7源码安装Nginx_第1页
CentOS7源码安装Nginx_第2页
CentOS7源码安装Nginx_第3页
CentOS7源码安装Nginx_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、CentOS7源码安装Nginx系统平台:腾讯云效劳器CentOS7.3 64位一、安装编译工具及库文件rootVM_0_5_centos # yum install -y make zlib zlib-devel gcc-c+ libtool openssl openssl-devel二、安装pcrePCRE作用是让Nginx支持Rewrite功能1、下载PCRE包rootVM_0_5_centosrootVM_0_5_centos# cd /usr/local/src/src# wge式 :/2、解压安装包rootVM_0_5_centossrc# tarzxvf pcre-8.35.ta

2、r.gz3进入解压后安装包目录rootVM_0_5_centossrc# cdpcre-8.354编译安装rootVM_0_5_centospcre-8.35#./configurerootVM_0_5_centospcre-8.35#makerootVM_0_5_centospcre-8.35#make install5查看pcre版本rootVM_0_5_centospcre-8.35#pcre-config-version8.35三、安装Nginx1、下载 NginxrootVM_0_5_centosnginx-1.16.0#rootVM_0_5_centosnginx-1.16.0#r

3、ootVM_0_5_centosnginx-1.16.0#-prefix指定安装路径5、查看nginx版本./configure -prefix=/usr/local/nginx make make install-with- _stub_status_module-with- _ssl_module-with-pcre=/usr/local/src/pcre-8.35rootVM_0_5_centos nginx-1.16.0#nginx version:nginx/1.16.0四、Nginx配置/usr/local/nginx/sbin/nginx-vrootVM_0_5_centosro

4、otVM_0_5_centos2、解压安装包# cd /usr/local/src/src#wget :/download/nginx-1.16.0.tar.gzrootVM_0_5_centos区进入解压后的目录src#tar zxvf nginx-1.16.0.tar.gzrootVM_0_5_centos4编译安装src#cd nginx-1.16.0创立Nginx运行使用的用户wwwrootVM_0_5_centos# groupadd wwwrootVM_0_5_centos# useradd-g www www修改配置文件rootVM_0_5_centos一# v

5、im /usr/local/nginx/conf/nginx.confuser www www; #指定用户名和组名worker_processes1; #设置值和cpu核心数一致error_loglogs/error.log;error_loglogs/error.lognotice;error_loglogs/error.loginfo;pidlogs/nginx.pid;events worker_connections1024; includemime.types;'/default_typeapplication/octet-stream;log_format main &#

6、39;$remote_addr - $remote_user $time_local "$request" '$status $body_bytes_sent "$ _referer" ' '"$ _user_agent""$ _x_forwarded_for"'access_loglogs/access.logmain;sendfileon;tcp_nopushon;#keepalive_timeout0;keepalive_timeout60;#gzip on;server li

7、sten80;server_namelocalhost;#charset koi8-r;#access_loglogs/host.access.logmain;location / rootindex html;index.htmlindex.htm;#error_page404/404.html;# another virtualhostusingmix ofIP-,name-,and port-based#server configuration# redirectserver#error pages to thestaticpage /50x.htmlerror_page500locat

8、ion= /50x.htmlroothtml;502503 504 /50x.html;# proxy the PHP scriptsto Apache#location .php$ #proxy_pass :/;#listeningon :80# pass the PHP scripts #location .php$ # root# fastcgi_pass# fastcgi_index# fastcgi_param# include#to FastCGI server listeningon :9000html;:9

9、000;index.php;SCRIPT_FILENAME/scripts$fastcgi_script_name;fastcgi_params;# deny access to .htaccess files,# concurs with nginx's one#location /.ht# deny all;#ifApache's document root#listen8000;#listensomename:8080;#server_namesomename aliasanother.alias;#location/ #roothtml;#indexindex.html

10、index.htm;# S server#server # listen443 ssl;# server_namelocalhost;# ssl_certificatecert.pem;# ssl_certificate_keycert.key;shared:SSL:1m;5m;#ssl_session_cache#ssl_session_timeout# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_cipherson;# location / html;index.html index.htm;#root#index#后续根据需要配置;检

11、查配置文件nginx.conf的正确性命令:rootVM_0_5_centos conf#nginx:the configurationnginx:configurationfile/usr/local/nginx/sbin/nginxfile /usr/local/nginx/conf/nginx.conf/usr/local/nginx/conf/nginx.conf-ttest issyntax is oksuccessful五、启动NginxrootVM_0_5_centosconf#/usr/local/nginx/sbin/nginx八、Nginx其他查用命令rootVM_0_5_centoscon

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论