nginx

nginx的静态网页部署

将一个前端项目部署到nginx上,利用nginx服务器进行访问即nginx的静态网页部署

先用wincp访问远程服务器主机名:47.115.3.102

47.115.3.102 是你购买的云服务器IP 

我的nginx目录在/etc/nginx下,在sites-available中配置如下

server {
    listen       80;
    server_name  47.115.3.102;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   html;
        index  index.html; # 默认加载根路径文件
    }
    location /ace {
        root   /var/www;
        index  login.html; # 默认加载根路径文件
    }


    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.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;

更改配置文件后要重启nginx服务

遇到问题是nginx.service:control process exited进程已经存在了
需要找到nginx的进程号:ps -ef | grep nginx
执行命令:kill -QUIT pid
然后重启:service nginx restart

重启后在浏览器输入47.115.3.102/ace 即可访问login.html登陆页面

ace文件夹放置在/var/www下 login.html为ace下的文件

ace项目  https://github.com/XinLiangCoder/AceAdmin.git
可以通过git clone https://github.com/XinLiangCoder/AceAdmin.git下载到本地仓库
浏览器输入47.115.3.102/ace/index.html 就能打开主页页面

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值