nginx配置多站点配置文件conf

打开conf文件夹的nginx.conf文件,Nginx服务器的基础配置,默认的配置也存放在此

server {
listen 80;
server_name 域名.com;
return 301 http://www.域名.com$request_uri;
}

server {
listen 80;
server_name www.域名.com;

return 301 https://$server_name$request_uri;

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

location / {
root /mydata/web/blog;
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;
}

# 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$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$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;
#}
}

server {
listen 443 ssl;
server_name www.域名.com;
root /mydata/web/blog;
index index.html index.htm;
ssl_certificate cert/5040383_www.域名.pem;
ssl_certificate_key cert/5040383_www.域名.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; #表示使用的TLS协议的类型。
ssl_prefer_server_ciphers on;
location / {
root /mydata/web/blog; #站点目录。
index index.html index.htm;
}
}

0
显示验证码