With the Brew install Nginx installs the latest version of Nginx, but in some cases, the installation of third-party plug-ins requires a specific version, a higher version may not be installed.
Its principle is to download the installation package for automatic installation, set up a soft chain, so that there will be nginx command output in the console
Install with Package
Download the required installation package from the official website, the official website address
Nginx
Download it, unzip the TAB key is the full file name
.tar.gz 和 .tgz
解压:tar zxvf FileName.tar.gz
压缩:tar zcvf FileName.tar.gz DirName
Enter the unzip file in the CD * * */nginx-1.4.3 inside
Execute./configure Enter
Then make
Make install such nginx installation is successful, the native installation directory is
/usr/local/nginx inside
There's nginx in the sbin below this directory.
Execute./nginx-c conf/nginx.conf start Nginx
./nginx-s Stop/reload is the stop and restart Nginx
/usr/local/nginx/sbin/nginx /usr/local/bin/nginx 做个软连接。
nginx -V 查看版本,以及配置文件地址
ninx -v 查看版本
nginx -c filename 指定配置文件
nginx -h 帮助
2、重新加载配置|重启|停止|退出 nginx
nginx -s reload|reopen|stop|quit
打开 nginx
sudo nginx
3、测试配置是否有语法错误
nginx -t
Install third-party module content
Markdown Parsing module Address
If the primary master branch is not installed at the time of installation, use the releases version, because this version is a release version.
Download the module package
Load it up before you pack it.
Discount Bag
Otherwise the module cannot be loaded, because markdown needs this parser
首先进入nginx安装目录,cd /usr/local/nginx
执行 ./configure \
--add-module=/Users/lirong/works/nginx/ngx-markdown-module-mdfilter-0.1/ngx-md-filter-module
然后make
make install
nginx -V 会显示是否安装成功
The directory browsing features are as follows:
vi/usr/local/ nginx/conf/nginx.conf #编辑配置文件, add the following under HTTP {:
AutoIndex on; #开启nginx目录浏览功能
Autoindex_exact_size off; #文件大小从KB开始显示
Autoindex_localtime on; #显示文件修改时间为服务器本地时间
: wq! #保存, exit
Configuration with directory browsing, setting the root directory, with settings to parse markdown filtering function
/usr/ local/nginx/conf/nginx.conf inside the settings (in server)
root/users/lirong/works/ svn
location/{
autoindex on;
ssi on;
set $ENV _type "dev";
index index.html index.htm index.php;
}
# use Filter module
location ~/*.md {
mdfilter on;
mdfilter_utf8 on;
}
/span>
使用“ps -e|grep nginx”命令,查看nginx程序的对应的pid号
使用“kill -9 2891”命令,可以结束掉2891进程。
使用"killall nginx"命令,可以杀掉所有已nginx命名的进程。
从容停止 kill -QUIT 主进程号
快速停止 kill -TERM 主进程号
强制停止 kill -9 nginx
退出vi及保存文件
在「命令行模式(command mode)」下,按一下「:」冒号键进入「Last line mode」,例如:
:w filename (输入 「w filename」将文章以指定的文件名filename保存)
:wq! (输入「wq」,存盘并退出vi)
:q! (输入q!, 不存盘强制退出vi)
If installing Nginx under Apple, install markdown third-party plug-in for Nginx