nginx怎么配置


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

# For more information on configuration, see:

#   * Official English Documentation: http://nginx.org/en/docs/

#   * Official Russian Documentation: http://nginx.org/ru/docs/

 

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;

 

# Load dynamic modules. See /usr/share/nginx/README.dynamic.

include /usr/share/nginx/modules/*.conf;

 

events {

    worker_connections 1024;

}

 

http {

    log_format  main  '$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.log  main;

 

    sendfile            on;

    tcp_nopush          on;

    tcp_nodelay         on;

    keepalive_timeout   65;

    types_hash_max_size 2048;

 

    gzip on;

    gzip_static on;

    gzip_min_length 1024;

    gzip_buffers 4 16k;

    gzip_comp_level 2;

    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript   application/x-httpd-php application/vnd.ms-fontobject font/ttf font/opentype font/x-woff image/svg+xml;

    gzip_vary off;

    gzip_disable "MSIE [1-6]\.";

 

    include             /etc/nginx/mime.types;

    default_type        application/octet-stream;

 

    # Load modular configuration files from the /etc/nginx/conf.d directory.

    # See http://nginx.org/en/docs/ngx_core_module.html#include

    # for more information.

    include /etc/nginx/conf.d/*.conf;

 

    server {

        listen       80 default_server;

        listen       [::]:80 default_server;

        server_name  _;

        root         /usr/share/nginx/html;

 

        # Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;

 

        location / {

        }

 

        error_page 404 /404.html;

            location = /40x.html {

        }

 

        error_page 500 502 503 504 /50x.html;

            location = /50x.html {

        }

    }

 

    server {

         listen 443;

         server_name mp.hanxing.store;

         ssl on;

         index index.html index.htm;

         ssl_certificate   cert/cert_mp.hanxing.store.crt;

         ssl_certificate_key  cert/cert_mp.hanxing.store.key;

         ssl_session_timeout 5m;

         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

         ssl_prefer_server_ciphers on;

         location / {

            root   /public/sell/app/dist;

            index  index.php index.html index.htm;

         }

         location /sell {

             proxy_set_header   X-Real-IP $remote_addr;

             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

             proxy_set_header   Host      $http_host;

             proxy_set_header X-NginX-Proxy true;

             proxy_pass         http://127.0.0.1:8080;

             proxy_redirect off;

         }

         error_page 404 /404.html;

              location = /40x.html {

         }

         error_page 500 502 503 504 /50x.html;

            location = /50x.html {

         }

    }

}

以上就是nginx怎么配置的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

位运算与nginx性能的联系

nginx运维中怎么样平滑升级

linux如何启动nginx

如何重新编译已安装的nginx

nginx的进程名称是什么

如何解决nginx:未找到命令问题

修改nginx上传文件大小配置

nginx如何添加stream模块

linux服务器如何安装nginx

nginx开源吗

更多相关阅读请进入《nginx》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...