一.登陆后创建一个新用户(例如 mirror)
useradd mirror
passwd mirror
输入两次密码
二.安装图形界面:
yum groupinstall "Desktop" "X Window System" "Chinese Support" "Internet Browser" "Fonts"
vi /etc/inittab
将3改成5
reboot
用mirror登陆
三.配置LNMP环境
1.基础设置:
1)关闭SELINUX
修改配置文件,重启服务后永久生效。
# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
命令行设置立即生效。
# setenforce 0
2)安全组设置
在ECS安全组放行需访问的端口和访问白名单,下面的示例表示允许所有IP访问服务器的80端口。您可以根据实际情况放行允许访问的客户端IP。
2.安装nginx
1)添加运行nginx服务进程的用户
- # groupadd -r nginx
- # useradd -r -g nginx nginx
2)下载源码包解压编译。
- # wget http://nginx.org/download/nginx-1.10.2.tar.gz
- # tar xvf nginx-1.10.2.tar.gz -C /usr/local/src
- # yum groupinstall "Development tools"
- # yum -y install gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel
- # cd /usr/local/src/nginx-1.10.2
- # ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --user=nginx --group=nginx --with-pcre --with-http_v2_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-threads --with-stream --with-stream_ssl_module
- # make && make install
- # mkdir -pv /var/tmp/nginx/client
3)添加SysV启动脚本。
- # vim /etc/init.d/nginx
- #!/bin/sh
- #
- # nginx - this script starts and stops the nginx daemon
- #
- # chkconfig: - 85 15
- # description: Nginx is an HTTP(S) server, HTTP(S) reverse \
- # proxy and IMAP/POP3 proxy server
- # processname: nginx
- # config: /etc/nginx/nginx.conf
- # config: /etc/sysconfig/nginx
- # pidfile: /var/run/nginx.pid
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Check that networking is up.
- [ "$NETWORKING" = "no" ] && exit 0
- nginx="/usr/sbin/nginx"
- prog=$(basename $nginx)
- NGINX_CONF_FILE="/etc/nginx/nginx.conf"
- [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
- lockfile=/var/lock/subsys/nginx
- start()