Ubuntu 编译安装LNMP 环境多图详述

Ubuntu 编译安装LNMP 环境多图详述,这里用Nginx1.2.0+mysql5.6.33+php5.6.2搭配安装环境

---------------------------------Nginx BEGIN---------------------------------

使用命令下载nginx安装包,用的是稳定版, 这里下载: <nginx1.6.2>

下载下来后就解压一下

解压后得到一个nginx-1.12.0的文件夹

进入文件夹, 运行命令:

Ubuntu 编译安装LNMP 环境多图详述

回车运行脚本配置后, 这里要注意一下, 有可能会缺失zlib, ssh等库, 这个没关系, 查找 sudo apt-cache search xxx(库) 然后 sudo apt-get install xxx(对应库名)  就行了

这里可以参考: Nginx官网安装  的文章

成功后再运行: 

sudo make

sudo make install

要想加入自启动的话, 得在/etc/init.d/ 下建nginx  里面填上

#! /bin/sh ###BEGIN INIT INFO # Provides: nginx # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/nginx/sbin/nginx NAME=nginx DESC=nginx test -x $DAEMON || exit 0 # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then . /etc/default/nginx # . /usr/local/nginx/conf fi set -e . /lib/lsb/init-functions case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \ --exec $DAEMON -- $DAEMON_OPTS || true echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \ --exec $DAEMON || true echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile \ /usr/local/nginx/logs/$NAME.pid --exec $DAEMON || true sleep 1 start-stop-daemon --start --quiet --pidfile \ /usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true echo "$NAME." ;; reload) echo -n "Reloading $DESC configuration: " start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \ --exec $DAEMON || true echo "$NAME." ;; status) status_of_proc -p /usr/local/nginx/logs/$NAME.pid "$DAEMON" nginx && exit 0 || exit $? ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2 exit 1 ;; esac exit 0

启动nginx 和看是否启动进程成功

Ubuntu 编译安装LNMP 环境多图详述

浏览器运行 localhost 看到这个就说明启动成功了:

Ubuntu 编译安装LNMP 环境多图详述

---------------------------------------------Nginx END---------------------------------------------

---------------------------------------------MySQL BEGIN---------------------------------------------

1 通过命令下载:

2 解压后直接复制到软件夹, 免安装

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/5d1466d352cd2eed8329f04368224381.html