@tsingwong
2016-10-13T08:26:46.000000Z
字数 1241
阅读 1126
nginx
hexo
最初安装的hexo之后,使用的是 hexo g
去发布站点,那个默认发布到 4000 端口,所以使用 nginx 去反向代理到 4000 端口。
# /usr/local/nginx/nginx.conf
server {
listen 80;
server_name www.tsingwong.cn;
#charset koi8-r;
#access_log logs/host.access.log main;
# location / {
# root html;
# index index.html index.htm;
# }
...
最初安装的hexo之后,使用的是 hexo g
去发布站点,那个默认发布到 4000 端口,所以使用 nginx 去反向代理到 4000 端口。
# /usr/local/nginx/nginx.conf
server {
listen 80;
server_name www.tsingwong.cn;
#charset koi8-r;
#access_log logs/host.access.log main;
# location / {
# root html;
# index index.html index.htm;
# }
location / {
proxy_pass http://127.0.0.1:4000/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#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 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;
#}
}
后来发现这种方法只适用于自己测试用,如果部署网站的话还是应该 部署静态站点