1 Star 0 Fork 0

iamdsy / nginx-blog

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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

About

a blog module based on nginx which can be written with markdown expand collapse
C++
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
C++
1
https://gitee.com/iamdsy/nginx-blog.git
git@gitee.com:iamdsy/nginx-blog.git
iamdsy
nginx-blog
nginx-blog
master

Search