🎶 Sym - 一款用 Java 实现的现代化社区(论坛/BBS/社交网络/博客)平台

📕 思源笔记 - 一款桌面端笔记应用,支持 Windows、Mac 和 Linux

🎸 Solo - B3log 分布式社区的博客端节点,欢迎加入下一代社区网络

♏ Vditor - 一款浏览器端的 Markdown 编辑器

Linux 中如何安装 Nginx

最近开始折腾 Nginx,Windows 下的就不说了。Linux 就大学那会学过,在上一家公司用过的命令也不超过5个,纯属菜鸟级别。

首先安装 SecureCRT,然后在会话选项 -> 终端 -> 外观中修改当前颜色方案为 Traditional ,选择字符编码,选择你喜欢的字体。这样就可以装下,让人觉得你会这个东东的样子,同时也增加自己的信心——输命令吧,木有问题 o(∩_∩)o

nginx

网上一搜一堆一堆的,这里就带着 Linux 命令简单说下如何安装

1.1 cd 到你想要的目录,如 #cd /opt

1.2 建立所需存放安装文件的文件夹,如 #mkdir install

1.3 进入该目录,如 #cd install

1.4 获取安装文件 #wget http://nginx.org/download/nginx-1.0.15.tar.gz

1.5 查看文件 #ls

1.6 解压#tar xzvf nginx-1.0.15.tar.gz

1.7 进入解压好的文件中 #cd nginx-1.0.15

1.8 #./configure --prefix=/opt/nginx

1.9 #make

1.10 #make install

1.11 上传需要使用的静态文件到 html 下
        #cd /opt/nginx/html
        #rz 

1.12 启动
        #cd /opt/nginx/sbin
        #./nginx

 

使用到的命令说明

cd
定位路径,和 Windows 的 cmd 一样

mkdir
用法:mkdir [选项] 目录...
若目录不是已经存在则创建目录。

长选项必须用的参数在使用短选项时也是必须的。
  -m, --mode=模式   设定权限<模式> (类似 chmod),而不是 rwxrwxrwx 减 umask
  -p, --parents     需要时创建上层目录,如目录早已存在则不当作错误
  -v, --verbose     每次创建新目录都显示信息
  -Z, --context=CONTEXT (SELinux) set security context to CONTEXT
      --help     显示此帮助信息并退出
      --version  输出版本信息并退出

wget
非交互式的网络文件下载工具。
用法: wget [选项]... [URL]...
参数太多了,还没带过。参见 wget

ls
列出目标目录中所有的子目录和文件。
用法:ls [选项]... [目录名]...
参数太多了,还没带过。参见 ls

tar
Usage: tar [OPTION...] [FILE]...
saves many files together into a single tape or disk archive, and can restore individual files from the archive.

Examples:
  tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
  tar -tvf archive.tar         # List all files in archive.tar verbosely.
  tar -xf archive.tar          # Extract all files from archive.tar.

参数太多了,还没带过。参见 tar

rz
上传文件
Usage: rz [options] [filename.if.xmodem]
Receive files with ZMODEM/YMODEM/XMODEM protocol
    (X) = option applies to XMODEM only
    (Y) = option applies to YMODEM only
    (Z) = option applies to ZMODEM only
  -+, --append                append to existing files
  -a, --ascii                 ASCII transfer (change CR/LF to LF)
  -b, --binary                binary transfer
  -B, --bufsize N             buffer N bytes (N==auto: buffer whole file)
  -c, --with-crc              Use 16 bit CRC (X)
  -C, --allow-remote-commands allow execution of remote commands (Z)
  -D, --null                  write all received data to /dev/null
      --delay-startup N       sleep N seconds before doing anything
  -e, --escape                Escape control characters (Z)
  -E, --rename                rename any files already existing
      --errors N              generate CRC error every N bytes (debugging)
  -h, --help                  Help, print this usage message
  -m, --min-bps N             stop transmission if BPS below N
  -M, --min-bps-time N          for at least N seconds (default: 120)
  -O, --disable-timeouts      disable timeout code, wait forever for data
      --o-sync                open output file(s) in synchronous write mode
  -p, --protect               protect existing files
  -q, --quiet                 quiet, no progress reports
  -r, --resume                try to resume interrupted file transfer (Z)
  -R, --restricted            restricted, more secure mode
  -s, --stop-at {HH:MM|+N}    stop transmission at HH:MM or in N seconds
  -S, --timesync              request remote time (twice: set local time)
      --syslog[=off]          turn syslog on or off, if possible
  -t, --timeout N             set timeout to N tenths of a second
  -u, --keep-uppercase        keep upper case filenames
  -U, --unrestrict            disable restricted mode (if allowed to)
  -v, --verbose               be verbose, provide debugging information
  -w, --windowsize N          Window is N bytes (Z)
  -X  --xmodem                use XMODEM protocol
  -y, --overwrite             Yes, clobber existing file if any
      --ymodem                use YMODEM protocol
  -Z, --zmodem                use ZMODEM protocol


svn co URL
用 svn checkout


欢迎注册黑客派社区,开启你的博客之旅。让学习和分享成为一种习惯!

推荐阅读
留下你的脚步