Nginx http服务相关的配置文件

开发 前端
本文主要讲述Nginx http服务,怎样创建Nginx http服务项目。这些内容都是一些门户网站和技术论坛找到的,中间可能有不少错误是我没有挑出的,欢迎大家指正。

Nginx http服务配置文件有很多需要我们掌握的命令,下面我们就来详细的看看有关的问题如何才能解决。只有不断的学习才能更好的掌握有关的Nginx http服务配置的技巧。

  1. user www www;  
  2. worker_processes 5;  
  3. error_log /var/nginx/logs/error.log;  
  4. #error_log logs/error.log notice;  
  5. #error_log logs/error.log info;  
  6. pid /var/nginx/nginx.pid;  
  7. events {  
  8. use epoll;  
  9. worker_connections 1024;  
  10. }  
  11. http {  
  12. include mime.types;  
  13. default_type application/octet-stream;  
  14. root /var/www/htdocs/;  
  15. log_format main '$remote_addr - $remote_user [$time_local] $request '  
  16. '"$status" $body_bytes_sent "$http_referer" '  
  17. '"$http_user_agent" "$http_x_forwarded_for"';  
  18. access_log /var/nginx/logs/access.log main;  
  19. sendfile on;  
  20. tcp_nopush on;  
  21. #keepalive_timeout 0;  
  22. keepalive_timeout 65;  
  23. gzip on;  
  24. server {  
  25. listen 80;  
  26. server_name localhost;  
  27. #charset koi8-r;  
  28. access_log /var/nginx/logs/host.access.log main;  
  29. location / {  
  30. root /var/www/htdocs/;  
  31. index index.html index.htm index.php;  
  32. }  
  33. error_page 404 /404.html;  
  34. error_page 500 502 503 504 /50x.html;  
  35. location = /50x.html {  
  36. root /var/www/htdocs;  
  37. }  
  38. location ~ \.php$ {  
  39. root html;  
  40. fastcgi_pass 127.0.0.1:10005;  
  41. fastcgi_index index.php;  
  42. fastcgi_param SCRIPT_FILENAME /var/www/htdocs/$fastcgi_script_name;  
  43. include fastcgi_params;  
  44. }  
  45. location ~ /\.ht {  
  46. deny all;  
  47. }  
  48. }  

以上就是对Nginx http服务的详细介绍,希望大家有所收获。

【编辑推荐】

  1. Linux Nginx相关问题解决方案
  2. Nginx反向代理与服务器的配置缓冲
  3. nginx静态文件的配置与安全认定
  4. Nginx状态监控如何实现自己的作用
  5. 深入学习有关Nginx负载均衡的安装过程
责任编辑:张浩 来源: 博客园
相关推荐

2010-03-29 09:23:00

2010-08-05 14:36:07

NFS服务

2010-11-12 09:44:59

Cassandra配置

2014-06-09 10:36:00

2010-03-25 18:31:03

Nginx配置文件

2020-04-09 13:23:29

Nginx配置文件模板

2009-12-21 11:19:50

WCF配置文件

2010-03-02 15:28:51

Linux系统用户

2010-03-01 10:14:01

Linux usera

2010-03-25 17:46:27

nginx配置文件

2010-03-25 18:09:23

Nginx配置文件

2010-03-01 15:26:18

Linux配置文件

2010-01-13 13:50:53

CentOS Vsft

2021-06-29 13:09:07

服务配置文件

2010-02-06 14:00:05

Linux Nginx

2018-02-27 11:08:11

2011-02-25 16:39:34

proftpd配置文件

2011-03-25 17:13:37

Nagios配置文件

2010-02-26 14:46:56

Linux user

2010-03-29 10:26:06

Nginx配置文件
点赞
收藏

51CTO技术栈公众号