docker 安装Nginx 虚拟主机配置文件

server {
    listen       80;
    server_name  dc.cms.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    
    location / {
      if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,OPTIONS';
            add_header 'Access-Control-Allow-Headers' 'Authorization,Authorization-Open,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
            add_header 'Access-Control-Max-Age' 3600;
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204;
      }
      add_header 'Access-Control-Allow-Origin' '*';
      add_header 'Access-Control-Allow-Methods' 'GET, POST,DELETE,PUT,OPTIONS';
      add_header 'Access-Control-Allow-Headers' 'Authorization,Authorization-Open,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
      try_files $uri $uri/ /index.php?$query_string;
    }


    #    location / {
    #        root   /usr/share/nginx/html/dc.cms.com/public/;
    #        index  index.html index.htm;
    #    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html/dc.cms.com/public/;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   php:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/html/dc.cms.com/public/$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

你可能感兴趣的:(docker 安装Nginx 虚拟主机配置文件)