https配置
在配置之前,要确定nginx是否支持ssl,在这里我使用的是openresty,所以已默认创建了一个。 首先要去生成一个ssl证书,可以自己颁发,但是无法将其接入平台进行开发,在这里使用的是云平台的证书颁发。 证书获取之后,将其下载下来,创建一个目录存放证书,如果有多站点,最好通过文件夹名称区分站点证书。
mkdir -p cert/your.domain.com
大约 1 分钟
在配置之前,要确定nginx是否支持ssl,在这里我使用的是openresty,所以已默认创建了一个。 首先要去生成一个ssl证书,可以自己颁发,但是无法将其接入平台进行开发,在这里使用的是云平台的证书颁发。 证书获取之后,将其下载下来,创建一个目录存放证书,如果有多站点,最好通过文件夹名称区分站点证书。
mkdir -p cert/your.domain.com
首先在配置文件夹中创建一个以对应要分流的站点域名为名称的配置文件,
touch example.com.conf
设定配置如下:
server {
listen 80;
server_name example.com;
#charset koi8-r;
access_log /usr/local/openresty/nginx/logs/example.com.log;
location / {
root /usr/local/openresty/nginx/html/example.com;
index index.html index.htm;
try_files $uri $uri/ /index.html; #这里是为了能使vue运行的配置
}
#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/local/openresty/nginx/html/example.com;
}
# 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 /usr/local/openresty/nginx/html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
#location ~ ^/(images|img|javascript|js|css|flash|media|static)/ {
# root /usr/local/openresty/nginx/html/default/assets/;
# autoindex on;
# access_log off;
# expires 30d;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
1、创建脚本/usr/local/webserver/nginx/sbin/cut_nginx_log.sh
vi /usr/local/webserver/nginx/sbin/cut_nginx_log.sh
首先创建一个名为Nginx的文件夹,然后在里面创建一个html文件夹以及config.d文件夹(这两个分别是网站目录以及nginx配置目录)
mkdir -p /data0/Nginx
cd Nginx
mkdir html
mkdir config.d
先前在本地部署了一台nginx,原本误将其重定向至博客网站,但是在及时修正之后,Firefox仍重定向该网站上去。
只能通过清除Firefox今日的网站记录缓存,才能解决这个问题