CentOS 7.x 服务器文件目录 (JDK & Redis & Nginx 安装)

1、JDK

tar -xvf jdk-8u321-linux-x64.tar.gz -C /usr/lib/jvm
JDK 的下载和安装(Windows+Linus 详细教程)

2、Redis

Linux 下安装步骤
在这里插入图片描述

3、Nginx 安装步骤

(yum update、yum install -y + 软件、 wget + url
SSL: yum install -y openssl openssl-devel)
1、下载:http://nginx.org/en/download.html
在这里插入图片描述
2、配置:
[root@dixinkk nginx-1.16.1]# ./configure --prefix=/usr/local/nginx 安装路径
3、编译:make
4、安装:make install

[root@dixinkk nginx-1.16.1]# cd /usr/local/nginx
[root@dixinkk nginx]# ls
conf  html  logs  sbin
[root@dixinkk nginx]# ls sbin/
nginx
[root@dixinkk nginx]# nginx
-bash: nginx: command not found
[root@dixinkk sbin]#  /usr/local/nginx/sbin/nginx

5、设置环境变量,使得在任意目录下输入nginx都可以执行
在这里插入图片描述
保存完 source 一下生效
在这里插入图片描述
6、启动
在这里插入图片描述

7、查看进程
在这里插入图片描述

8、已启动 -> 浏览器中访问公网ip
在这里插入图片描述
9、终止进程 kill -9

[root@dixinkk ~]# ps -aux | grep nginx
root     11087  0.0  0.0  20496   612 ?        Ss   09:03   0:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody   11088  0.0  0.0  20948  1576 ?        S    09:03   0:00 nginx: worker process
root     12645  0.0  0.0 112648   968 pts/0    S+   09:27   0:00 grep --color=auto nginx

[root@dixinkk ~]# kill -9 11087 11088

[root@dixinkk ~]# ps -aux | grep nginx
root     12713  0.0  0.0 112648   968 pts/0    S+   09:28   0:00 grep --color=auto nginx

10、浏览器中访问公网ip
两种可能:①阿里云防火墙拦截 ②nginx没启动
在这里插入图片描述
区分以上两种情况:
在nginx服务器里访问自己(本地): curl http://127.0.0.1
即使阿里云防火墙做了限制,本地也应该是可以访问的
若本地都访问不了,说明自己程序有问题

[root@dixinkk ~]# curl http://127.0.0.1
curl: (7) Failed connect to 127.0.0.1:80; Connection refused

非常有用的调试技巧 curl

遇到java程序外网无法访问:
测试java程序接口:curl http://127.0.0.1:8080/xxxx

11、部署前端项目

[root@dixinkk ~]# cd /usr/local/
[root@dixinkk local]# ls
aegis  bin  cloudmonitor  etc  games  include  lib  lib64  libexec  nginx  sbin  share  src
[root@dixinkk local]# cd nginx/
[root@dixinkk nginx]# ls
client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp  sbin  scgi_temp  uwsgi_temp
[root@dixinkk nginx]# ll
total 36
drwx------ 2 nobody root 4096 Apr  6 09:03 client_body_temp
drwxr-xr-x 2 root   root 4096 Apr  6 09:01 conf
drwx------ 2 nobody root 4096 Apr  6 09:03 fastcgi_temp
drwxr-xr-x 2 root   root 4096 Apr  6 09:01 html
drwxr-xr-x 2 root   root 4096 Apr  6 09:03 logs
drwx------ 2 nobody root 4096 Apr  6 09:03 proxy_temp
drwxr-xr-x 2 root   root 4096 Apr  6 09:01 sbin
drwx------ 2 nobody root 4096 Apr  6 09:03 scgi_temp
drwx------ 2 nobody root 4096 Apr  6 09:03 uwsgi_temp
[root@dixinkk nginx]# cd conf
[root@dixinkk conf]# ls
fastcgi.conf          fastcgi_params          koi-utf  mime.types          nginx.conf          scgi_params          uwsgi_params          win-utf
fastcgi.conf.default  fastcgi_params.default  koi-win  mime.types.default  nginx.conf.default  scgi_params.default  uwsgi_params.default
[root@dixinkk conf]# vim nginx.conf


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html; //此处为相对路径,相对的是 /usr/local/nginx/conf
        }

下载前端代码 【unzip 解压 zip文件(下载命令 yum install unzip)】

[root@dixinkk html]# wget https://imcfile.oss-cn-beijing.aliyuncs.com/shizhan/file/392/dist.zip

[root@dixinkk html]# ls
50x.html  dist.zip  dixinkk.html  index.html

[root@dixinkk html]# unzip dist.zip

移动前端代码到html目录下

[root@dixinkk html]# ls
50x.html  dist  dist.zip  dixinkk.html  index.html  __MACOSX
[root@dixinkk html]# ll
total 28360
-rw-r--r-- 1 root root      494 Apr  6 09:01 50x.html
drwxr-xr-x 7 root root     4096 Jan  6  2020 dist
-rw-r--r-- 1 root root 29018922 Jan  7  2020 dist.zip
-rw-r--r-- 1 root root       22 Apr  6 19:47 dixinkk.html
-rw-r--r-- 1 root root      612 Apr  6 09:01 index.html
drwxrwxr-x 3 root root     4096 Jan  6  2020 __MACOSX
[root@dixinkk html]# rm -rf __MACOSX/
[root@dixinkk html]# ll
total 28356
-rw-r--r-- 1 root root      494 Apr  6 09:01 50x.html
drwxr-xr-x 7 root root     4096 Jan  6  2020 dist
-rw-r--r-- 1 root root 29018922 Jan  7  2020 dist.zip
-rw-r--r-- 1 root root       22 Apr  6 19:47 dixinkk.html
-rw-r--r-- 1 root root      612 Apr  6 09:01 index.html
[root@dixinkk html]# ls -al dist
total 52
drwxr-xr-x 7 root root  4096 Jan  6  2020 .
drwxr-xr-x 3 root root  4096 Apr  6 20:02 ..
drwxr-xr-x 2 root root  4096 Jan  6  2020 css
-rw-r--r-- 1 root root 10244 Jan  6  2020 .DS_Store
-rw-r--r-- 1 root root  4286 Jan  6  2020 favicon.ico
drwxr-xr-x 2 root root  4096 Jan  6  2020 fonts
drwxr-xr-x 9 root root  4096 Jan  6  2020 imgs
-rw-r--r-- 1 root root   838 Jan  6  2020 index.html
drwxr-xr-x 2 root root  4096 Jan  6  2020 js
drwxr-xr-x 3 root root  4096 Jan  6  2020 mock
[root@dixinkk html]# rm -rf dixinkk.html index.html 
[root@dixinkk html]# ll
total 28348
-rw-r--r-- 1 root root      494 Apr  6 09:01 50x.html
drwxr-xr-x 7 root root     4096 Jan  6  2020 dist
-rw-r--r-- 1 root root 29018922 Jan  7  2020 dist.zip
[root@dixinkk html]# mv dist/* .
[root@dixinkk html]# ll
total 28380
-rw-r--r-- 1 root root      494 Apr  6 09:01 50x.html
drwxr-xr-x 2 root root     4096 Jan  6  2020 css
drwxr-xr-x 2 root root     4096 Apr  6 20:04 dist
-rw-r--r-- 1 root root 29018922 Jan  7  2020 dist.zip
-rw-r--r-- 1 root root     4286 Jan  6  2020 favicon.ico
drwxr-xr-x 2 root root     4096 Jan  6  2020 fonts
drwxr-xr-x 9 root root     4096 Jan  6  2020 imgs
-rw-r--r-- 1 root root      838 Jan  6  2020 index.html
drwxr-xr-x 2 root root     4096 Jan  6  2020 js
drwxr-xr-x 3 root root     4096 Jan  6  2020 mock

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

心海非海_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值