nginx部署

OpenSSL创建私有CA

重置ESC镜像,再次连接时,因为缓存问题会提示失败:
λ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:S54ELHiEJBF+g9SUCcaqOjJEhsuOiERtt/25V5g6E1I.
Please contact your system administrator.
Add correct host key in C:\\Users\\admin/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\admin/.ssh/known_hosts:2
ECDSA host key for 47.98.232.174 has changed and you have requested strict checking.
Host key verification failed.

解决方法:

D:\comein\cmder
λ ssh-keygen -R 47.98.232.174
# Host 47.98.232.174 found: line 2
C:\Users\admin/.ssh/known_hosts updated.
Original contents retained as C:\Users\admin/.ssh/known_hosts.old
 ssh-keygen -f "/home/choldrim/.ssh/known_hosts" -R 192.168.2.108

linux 远程连接ssh提示IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY解决


ESC配置nginx:

step1:在阿里云添加了安全组规则,配置80端口

image.png

image.png

step2: nginx.conf用默认的配置内容(开始以为是server_name需要配置ip地址,其实不用)

#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;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;                                       
        #}                                                                        
                                                                                
        # deny access to .htaccess files, if Apache's document root               
        # concurs with nginx's one                                                
        #                                                                         
        #location ~ /\.ht {                                                       
        #    deny  all;                                                           
        #}                                                                        
    }                                                                             
                                                                                
                                                                                
    # another virtual host using mix of IP-, name-, and port-based configuration  
    #                                                                             
    #server {                                                                     
    #    listen       8000;                                                       
    #    listen       somename:8080;                                              
    #    server_name  somename  alias  another.alias;                             
                                                                                
    #    location / {                                                             
    #        root   html;                                                         
    #        index  index.html index.htm;                                         
    #    }                                                                        
    #}                                                                            
                                                                                
                                                                                
    # HTTPS server                                                                
    #                                                                             
    #server {                                                                     
    #    listen       443 ssl;                                                    
    #    server_name  localhost;                                                  
    #    ssl_certificate      cert.pem;          
    #    ssl_certificate_key  cert.key;          
                                                 
    #    ssl_session_cache    shared:SSL:1m;     
    #    ssl_session_timeout  5m;                
                                                 
    #    ssl_ciphers  HIGH:!aNULL:!MD5;          
    #    ssl_prefer_server_ciphers  on;          
                                                 
    #    location / {                            
    #        root   html;                        
    #        index  index.html index.htm;        
    #    }                                       
    #}                                           
                                                 
}                                                
                                                                                                        
配置前端静态页面地址

step3: 查询防火墙状态:firewall-cmd --state

image.png

step4:启用nginx:
./nginx -t:验证nginx配置文件是否正确

image.png

./nginx:启动nginx
./nginx -s stop:停止nginx
./nginx -s reload:重启Nginx服务
ps -ef | grep nginx:查看nginx进程

image.png

step5:公网ip访问(阿里云有分公ip和私ip,最开始用私ip一直访问不成功,后用公ip访问可以,lol)

image.png

你可能感兴趣的:(nginx部署)