Ali云主机安装Nginx和JAVA

防火墙配置

http://www.cnblogs.com/moxiaoan/p/5683743.html

 liuxin@KK-MINI  ~/.ssh  ssh [email protected]
Last login: Sat May 13 12:23:50 2017 from 101.81.52.22

Welcome to Alibaba Cloud Elastic Compute Service !

是在是中不到JDK7在哪里下载,yum源里都是openjdk

http://download.csdn.net/download/love254443233/9179483

于是就在本地下载了,然后传服务器上,没有端口限制,如果有就 -P port

scp  ./Desktop/jdk-7u79-linux-x64.tar.gz  [email protected]:/root
jdk-7u79-linux-x64.tar.gz                                                                             100%  146MB   3.7MB/s   00:40
 liuxin@KK-MINI  ~  ssh [email protected]
Last login: Sat May 13 12:54:52 2017 from 27.115.24.210

Welcome to Alibaba Cloud Elastic Compute Service !

  • 解压 tar -zxvf jdk-7u75-linux-x64.tar.gz
  • 配置java环境 ~/.bas_profile
  • 配置java环境变量就不讲了,直接
[root@izbp1gtcdnye16djqbbqjdz ~]# ls
jdk1.7.0_79  jdk-7u79-linux-x64.tar.gz
[root@izbp1gtcdnye16djqbbqjdz ~]# vi /etc/profile
[root@izbp1gtcdnye16djqbbqjdz ~]# . /etc/pro
profile    profile.d/ protocols
[root@izbp1gtcdnye16djqbbqjdz ~]# . /etc/profile
[root@izbp1gtcdnye16djqbbqjdz ~]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
[root@izbp1gtcdnye16djqbbqjdz ~]#

(1)使用yum安装nginx需要包括Nginx的库,安装Nginx的库

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

(2)使用下面命令安装nginx

yum install nginx

(3)启动Nginx

systemctl status nginx.service

用systemctl restart nginx.service重启

(4) cat /etc/nginx/nginx.conf 配置地址

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;


    server {
        listen       80;
        server_name  127.0.0.1:8080;

        location / {

            proxy_pass   http://127.0.0.1:8080;
        }

    }

}

server下的结点:

listen:监听80端口

server_name:转发到哪个地址

proxy_pass:代理到哪个地址

nginx常用命令(要进入到nginx的目录):

开启:start nginx

重启:nginx -s reload

你可能感兴趣的:(Ali云主机安装Nginx和JAVA)