1 Star 0 Fork 0

iamdsy / nginx-blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.11 KB
一键复制 编辑 原始数据 按行查看 历史
iamdsy 提交于 2018-01-07 01:33 . add-my-blog-as-a-demo-into-the-readme-file

nginx-blog

中文版readme点此处

clickhereto see the demo

a blog module based on nginx which can be written with markdown

just can be used on linux,have tested on ubuntu 16.04 and deepin 15.5

have tested with nginx-1.12.2,nginx-1.9.9

1.install

1.1 create ~/nginx-1.12.2/objs/Makefile

cd
git clone  https://www.gitee.com/iamdsy/nginx-blog
tar xvfz nginx-1.12.2.tar.gz
sudo apt-get install libpcre3-dev \
    libssl-dev perl make build-essential curl
cd nginx-1.12.2
./configure --prefix=/usr/local/nginx --add-module=../nginx-blog

1.2 modify ~/nginx-1.12.2/objs/Makefile

1.add "CXX = g++" under the "CC = cc"

2.add "CXXFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -std=c++11" under line "CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g"

3.change "LINK = $(CC)" to "LINK = $(CXX)"

4.find the nginx-blog compile option,change nginx-blog $(CC) to $(CXX),$(CFLAGS) to $(CXXFLAGS)

5.after modified,the Makefile looks like:

 CC =    cc
 CXX = g++
 CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g
 CXXFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -std=c++11
 CPP =   cc -E
 LINK =  $(CXX)

.........

objs/addon/nginx-blog/ngx_blog.o:	$(ADDON_DEPS) \
	../nginx-blog/ngx_blog.cpp
	$(CXX) -c $(CXXFLAGS)  $(ALL_INCS) \
		-o objs/addon/nginx-blog/ngx_blog.o \
		../nginx-blog/ngx_blog.cpp


objs/addon/nginx-blog/blog_home_page.o:	$(ADDON_DEPS) \
	../nginx-blog/blog_home_page.cpp
	$(CXX) -c $(CXXFLAGS)  $(ALL_INCS) \
		-o objs/addon/nginx-blog/blog_home_page.o \
		../nginx-blog/blog_home_page.cpp


objs/addon/nginx-blog/lib_markdown_parse.o:	$(ADDON_DEPS) \
	../nginx-blog/lib_markdown_parse.cpp
	$(CXX) -c $(CXXFLAGS)  $(ALL_INCS) \
		-o objs/addon/nginx-blog/lib_markdown_parse.o \
		../nginx-blog/lib_markdown_parse.cpp

....

1.3 compile and install

cd
cd nginx-1.12.2
make
sudo make install

2.configure nginx.conf

just add some configure option in http block

it looks like

user iamdsy;
http {
    src_root_dir  /home/iamdsy/my_blog/;
    dst_root_dir  /usr/local/nginx/html/;
    html_title  我的博客;
    blog_name   潼潼;
    blog_subname  文房;
    max_item_per_page  10;
....

3.blog dir structure

the root dir is /home/iamdsy/my_blog/

the md files under /home/iamdsy/my_blog/blog/

the about_me.md file under /home/iamdsy/my_blog/

3.others need to do

3.1 mkdir

cd /usr/local/nginx/html
sudo mkdir blog archive tags

3.2 copy style.css

cd 
sudo cp -rv nginx-blog/style.css /usr/local/nginx/html
cd /usr/local/nginx/html
sudo cp -rv style.css blog
sudo cp -rv style.css tags
sudo cp -rv style.css archive

3.3 run

cd /usr/local/nginx
sudo ./sbin/nginx

3.4 chown

cd /usr/local/nginx
sudo chown -R iamdsy html/*

4.todo

1.sort under per tag

C++
1
https://gitee.com/iamdsy/nginx-blog.git
git@gitee.com:iamdsy/nginx-blog.git
iamdsy
nginx-blog
nginx-blog
master

搜索帮助