重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

ubuntu下nginx配置文件

1、nginx.conf文件,路径为:/etc/nginx/nginx.conf

成都创新互联服务项目包括荔湾网站建设、荔湾网站制作、荔湾网页制作以及荔湾网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,荔湾网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到荔湾省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

#使用的用户和组 userwww-data; #指定工作衍生进程数(一般等于CPU总核数或总核数的两倍) worker_processes4; #指定PID存放的路径 pid/run/nginx.pid; #指定文件描述符数量 worker_rlimit_nofile51200; events{ #使用的网络I/O模型,linux戏台推荐采用epoll模型,freebsd系统采用kqueue模型 useepoll; #允许连接数 worker_connections51200; #multi_accepton; } http{ ## #基础设置 ## sendfileon; tcp_nopushon; tcp_nodelayon; keepalive_timeout65; types_hash_max_size2048; #server_tokensoff; server_names_hash_bucket_size128; #server_name_in_redirectoff; include/etc/nginx/mime.types; default_typeapplication/octet-stream; ## #日志设置 ## #指定错误日志存放路径数,错误日志记录的级别可选项为:[debug|info|notice|warn|error|crit] access_log/var/log/nginx/access.log; error_log/var/log/nginx/error.log; ## #压缩设置 ## gzipon; gzip_disable"msie6"; gzip_varyon; #gzip_proxiedany; gzip_comp_level2; gzip_buffers416k; gzip_http_version1.1; gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript; ## #nginx-naxsiconfig ## #Uncommentitifyouinstallednginx-naxsi ## #include/etc/nginx/naxsi_core.rules; ## #nginx-passengerconfig ## #Uncommentitifyouinstallednginx-passenger ## #passenger_root/usr; #passenger_ruby/usr/bin/ruby; ## #虚拟主机设置 ## include/etc/nginx/conf.d/*.conf; include/etc/nginx/sites-enabled/*; } #mail{ ##Seesampleauthenticationscriptat: ##http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # ##auth_httplocalhost/auth.php; ##pop3_capabilities"TOP""USER"; ##imap_capabilities"IMAP4rev1""UIDPLUS"; # #server{ #listenlocalhost:110; #protocolpop3; #proxyon; #} # #server{ #listenlocalhost:143; #protocolimap; #proxyon; #} #}

2、default服务主机配置文件,路径为:/etc/nginx/sites-available/default

#主机 server{ listen80; server_namewww.demo.com; root/home/zxl/wwwroot/demo/; indexindex.phpindex.htmlindex.htm; #如果没有可访问目录或文件 if(!-e$request_filename){ #将访问路径跳转至根目录下的index.php接受处理 rewrite^/(.*)$/index.php/$1last; break; } #处理请求路径满足匹配.php的响应   #“location~.php”==“location~.php($|/)”   #第一句的意思是如果请求字符中匹配到“.php”字符,就交给php解析器处理   #第二句的意思是如果请求字符中匹配到以“.php”字符为结尾的或“.php/”字符,就交给php解析器处理   #推荐采纳第二句 location~.php($|/) { #响应请求处理入口,使用php-fpm进行管理 fastcgi_passunix:/var/run/php5-fpm.sock; fastcgi_indexindex.php; fastcgi_split_path_info^(.+.php)(.*)$; fastcgi_paramPATH_INFO$fastcgi_path_info; fastcgi_paramPATH_TRANSLATED$document_root$fastcgi_path_info; fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; includefastcgi_params; } #配置静态图片文件客户端缓存时间 location~.*.(gif|jgp|jpeg|png|bmp|swf)$ { expires30d;#30天 } #配置js、css文件客户端缓存时间 location~.*.(js|css)?$ { expires1h;#1小时 } #设置访问日志保存格式 #log_formataccess\'$remote_addr-$remote_user[$time_local]"$request"\'\'$status$body_bytes_sent"$http_referer"\'\'"$http_user_agent"$http_x_forwarded_for\'; #设置访问日志保存路径 #access_log/var/log/nginx/access.logaccess; }


标题名称:ubuntu下nginx配置文件
文章源于:http://cqcxhl.cn/article/cjciid.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP