首页 > 系统相关 >一次web系统的nginx配置恢复

一次web系统的nginx配置恢复

时间:2023-02-17 21:57:30浏览次数:123  
标签:web index 配置 uri server machine nginx bak

前言:组里有一个小伙子,为了升级nodejs,安装各种库,把系统给搞崩溃了,无法登录。找运维人员也不行,最后的解决办法换一台机器。幸好原来只有一块盘,所以数据还在。

 

$ mv a/ b/ c/ .../ -t old_machine_bak # 把之前的数据都移到

第一步:找nginx配置

$ find old_machine_bak/ -name nginx

结果:

old_machine_bak/usr/sbin/nginx

old_machine_bak/usr/share/doc/nginx
old_machine_bak/usr/share/nginx
old_machine_bak/etc/default/nginx
old_machine_bak/etc/nginx
old_machine_bak/etc/logrotate.d/nginx
old_machine_bak/etc/init.d/nginx
old_machine_bak/etc/ufw/applications.d/nginx
old_machine_bak/var/log/nginx
old_machine_bak/var/lib/nginx
old_machine_bak/var/lib/docker/overlay2/4

 

看目录,nginx配置路径应该在:

$ /data/old_machine_bak/etc/nginx/sites-available

$ vi default

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 26659 default_server;
        listen [::]:26659 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php7.0-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php7.0-fpm:
        #       fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}

server {
        listen 26657;
        listen [::]:26657;

        # server_name example.com;
        server_name _;

        root /var/www/opendex-ui;
        index index.html;

        location / {
                # try_files $uri $uri/ =404;
                try_files $uri /index.html =404;
        }
}

server {
        listen 8081;
        listen [::]:8081;

        # server_name example.com;
        server_name _;

        root /var/www/remoteokcdev;
        index index.html;

        location / {
                # try_files $uri $uri/ =404;
                try_files $uri /index.html =404;
        }
}

server {
        listen 8082;
        listen [::]:8082;

        # server_name example.com;
        server_name _;

        root /var/www/remotegaiatest;
        index index.html;

        location / {
                # try_files $uri $uri/ =404;
                try_files $uri /index.html =404;
        }
}

server {
        listen 8083;
        listen [::]:8083;

        # server_name example.com;
        server_name _;

        root /var/www/remoteokctest;
        index index.html;

        location / {
                # try_files $uri $uri/ =404;
                try_files $uri /index.html =404;
        }
}

server {
        listen 8085;
        listen [::]:8085;

        # server_name example.com;
        server_name _;

        root /var/www/addOkcToKeplr;
        index index.html;

        #location / {
                # try_files $uri $uri/ =404;
        #       try_files $uri /index.html =404;
        #}
}

# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

 

第二步:把静态文件cp到/var下目录

原文件路径:/old_machine_bak/var/www

$ cd /data/old_machine_bak/var/www

 

$ cd /var

$ cp -R /data/old_machine_bak/var/www .

第三步:在新机器上安装nginx,并启动生效

试了一下,系统默认没有安装nginx

$ nginx
Command 'nginx' not found, but can be installed with:
apt install nginx-core # version 1.18.0-6ubuntu14.3, or
apt install nginx-extras # version 1.18.0-6ubuntu14.3
apt install nginx-light # version 1.18.0-6ubuntu14.3

 

安装nginx过程见另一篇文章:

https://www.cnblogs.com/zccst/p/15876682.html

 

标签:web,index,配置,uri,server,machine,nginx,bak
From: https://www.cnblogs.com/zccst/p/17131570.html

相关文章

  • Java Web(二)MyBatis
    MyBatis一.MyBatis简介1.什么是MyBatisMyBatis是一款优秀的持久层框架,用于简化JDBC开发MyBatis本是Apache的一个开源项目iBatis,2010年这个项目由apachesoftwarefoundati......
  • Vite 与 Webpack的区别
    1.什么是Vite?Vite是尤雨溪在开发vue3的时候开发的一个web开发构建工具。极速的服务启动:使用原生ESM文件,无需打包!轻量快速的热重载:无论应用程序大小如何,都......
  • Deepin系统中计划任务crontab配置conda环境,执行对应脚本
    Linux系统下使用crontab配置计划任务.具体配置可以参考对应说明文档.查看crontab状态:systemctlstatuscron●cron.service-Regularbackgroundprogramprocessin......
  • SpringMVC12 - 基于注解配置SpringMVC
    注解配置SpringMVC使用配置类和注解代替web.xml和SpringMVC配置文件的功能创建初始化类,代替web.xml在Servlet3.0环境中,容器会在类路径中查找实现javax.servlet.Servlet......
  • 交互式Web前端开发最有用的WebGL框架
    JavaScript是创建Web最有用的编程语言之一,尤其是在WebGL库的支持下。有了WebGL,可以很方便地使用HTML5Canvas元素动态生成图形。因此,设计师和开发人员很容易创建流畅的2D......
  • DBeaver配置数据库驱动
    1.情景展示我们知道,要想连接数据库,对应的数据库驱动(jar包)是少不了的;使用DBeaver连接数据库,如果是初次使用的话,会自动下载对应的jar包,遇到无法下载的情况;如何解决?2.具......
  • 黑猫web端signature参数逆向分析
    适合小白练手一、断点调试1.查找关键字2.分析nn是一个随机数16位u是固定参数u="$d6eb7ff91ee257475%"时间戳vard=(newDate).getTime()3.随机数生成o......
  • docker-compose 配置 es kibana
    直接上代码elasticsearch.ymlhttp:host:0.0.0.0xpack.security.enabled:falsexpack.security.enrollment.enabled:truexpack.security.http.ssl:enabled:fal......
  • 使用SpringBoot简单实现WebRTC群聊会议室(Mesh方案)
    近期需要做一个类似会议室功能,但网络上大多数是一对一通信,故记录分享希望帮助到有用的人WebRTC一对一聊天原理关于WebRTC建立一对一聊天的模板网上很多,可参考以下博客:spr......
  • 用于交互式Web前端开发最有用的WebGL框架
    JavaScript是创建Web最有用的编程语言之一,尤其是在WebGL库的支持下。有了WebGL,可以很方便地使用HTML5Canvas元素动态生成图形。因此,设计师和开发人员很容易创建流畅的2D......