nginx安装与配置

从今开始,学nginx #安装pcre [root@svr3~]#tar-xjfpcre-8.02.tar.bz2-C/usr/src/ [root@svr3~]#cd/usr/src/pcre-8.02/ [root@svr3pcre-8.02]#./configure&&make&&makeinstall #安装nginx [root@svr3~]#useradd-M-s/sbin/nologinnginx [root@svr3~]#tar-xzfnginx-1.0.5.tar.gz-C/usr/src/ [root@svr3~]#cd/usr/src/nginx-1.0.5/ [root@svr3nginx-1.0.5]#./configure--prefix=/usr/local/nginx--user=nginx--group=nginx [root@svr3nginx-1.0.5]#make&&makeinstall [root@svr3~]#vim/usr/local/nginx/conf/nginx.conf +++++++++++++++相关说明+++++++++++++++++++++++++++++ usernginx;#用户使用nginx worker_processes1;#程序启动后,初始化的进程数;内核多的话,可根据内核数量设置。 #error_loglogs/error.log; #error_loglogs/error.lognotice; error_loglogs/error.loginfo;#设置错误日志的记录级别 pidlogs/nginx.pid;#重启关闭nginx时,需要知道pid文件。 worker_rlimit_nofile51000; # events{ worker_connections50000;#允许的连接数,我这里设置50000个。 } http{ includemime.types; default_typeapplication/octet-stream; #log_formatmain\'$remote_addr-$remote_user[$time_local]"$request"\' #\'$status$body_bytes_sent"$http_referer"\'

创新互联长期为超过千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为扎兰屯企业提供专业的成都做网站、成都网站制作,扎兰屯网站改版等技术服务。拥有十多年丰富建站经验和众多成功案例,为您定制开发。

#\'"$http_user_agent""$http_x_forwarded_for"\'; #access_loglogs/access.logmain; sendfileon; tcp_nopushon; #keepalive_timeout0; keepalive_timeout30; gzipon;#允许gzip压缩。 gzip_buffers 32 4k; gzip_comp_level 1; gzip_min_length 1024; gzip_types text/html text/css application/xml; server{ listen80; server_namelocalhost; #charsetkoi8-r; access_loglogs/host.access.logmain; location/{ roothtml;#目录 indexindex.htmlindex.htm;#index类型 } #error_page404/404.html; #redirectservererrorpagestothestaticpage/50x.html # error_page500502503504/50x.html; location=/50x.html{ roothtml; } #这里是关于转发的部分 #proxythePHPscriptstoApachelisteningon127.0.0.1:80 # #location~.php${ #proxy_passhttp://127.0.0.1; #} #fastcgi的部分 #passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000 # #location~.php${ #roothtml; #fastcgi_pass127.0.0.1:9000; #fastcgi_indexindex.php; #fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name; #includefastcgi_params; #} #denyaccessto.htaccessfiles,ifApache\'sdocumentroot #concurswithnginx\'sone # #location~/.ht{ #denyall; #} } #anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration 虚拟主机的部分 } +++++++++++++++++++++++++++++++++++++++++++++ 现在就配置一台主机,改了以下内容: server{ listen80; server_namesvr3.labexam.com10.1.1.30; #charsetkoi8-r; access_loglogs/w1.access.logcombined; location/{ root/var/www/w1; indexindex.htmlindex.htm; } #看了下日志 [root@svr3nginx]#tail/usr/local/nginx/logs/w1.access.log 10.1.1.8--[15/Aug/2011:02:21:50+0800]"GET/HTTP/1.1"2008"-""Opera/9.80(WindowsNT5.1;U;zh-cn)Presto/2.9.168Version/11.50" 10.1.1.8--[15/Aug/2011:02:21:50+0800]"GET/favicon.icoHTTP/1.1"404142"http://svr3.labexam.com/""Opera/9.80(WindowsNT5.1;U;zh-cn)Presto/2.9.168Version/11.50" ===>如何启动nginx?<假定nginx安装在/usr/local/nginx中> 方法1、执行/usr/local/nginx/sbin/nginx-t检查配置文件是否有误!或是直接执行/usr/local/nginx/sbin/nginx 如果有多个配置文件可以使用指定的配置文件启动: #/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf ===>nginx的信号控制: TERM,INT快速关闭 QUIT从容关闭 HUP重启,重新加载配置文件 USR1重启打开日志,在切割日志时用途大 USR2平滑升级可执行程序 WINCH从容关闭进程

本文出自 “潜入技术的海洋” 博客,请务必保留此出处http://myhat.blog.51cto.com/391263/639564

文章名称:nginx安装与配置
分享URL:https://www.cdcxhl.com/article4/cjojie.html

成都网站建设公司_创新互联,为您提供云服务器企业建站网站建设面包屑导航商城网站做网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

搜索引擎优化