呼叫007 2021-09-03 11:29 采纳率: 63.2%
浏览 27
已结题

centos已经有一运行中网站域名,现在新增加一网站,想通过这个域名/backhome的方式把这个网站加上

服务器环境是lnmp;现在这个服务器上已经有一网站www.example.cc,现在我想新增一网站,用www.example.cc/backhome的方式打开这个网站,但是这个网站是tp5开发的,我应该怎么放上去,在nginx的conf里面怎么设置呢?

conf里面内容

server
{
    listen 80;
    server_name www.example.cc;
    index index.html index.htm index.php;
    root  /data/wwwroot/www.example.cc;
    error_log /var/log/nginx/www.example.cc-error.log crit;
    access_log  /var/log/nginx/www.example.cc-access.log;
    include extra/*.conf;
    include conf.d/rewrite/thinkphp.conf;

#------------- SSL Start --------------


#------------- SSL End  ---------------
    location /backhome
    {
         alias /data/wwwroot/backhome/public/;
         index index.php index.html;
         location ~ ^/backhome/.+\.php$ {
              alias /data/wwwroot/backhome/public/;
              fastcgi_pass  unix:/dev/shm/php-fpm-default.sock;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME /data/wwwroot/backhome/$fastcgi_script_name;
              include        fastcgi_params;
         }
         include conf.d/extra/*.conf;
    }
}

  • 写回答

1条回答 默认 最新

  • variation8 2021-09-03 13:42
    关注

    server
    {
    listen 80;
    server_name http://www.example.cc/backhome ;
    index index.html index.htm index.php;
    root /data/wwwroot/ The domain name Example.cc is for sale The domain name Example.cc is for sale. Make an offer or buy it now at a set price. http://www.example.cc/ ;
    error_log /var/log/nginx/www.example.cc-error.log crit;
    access_log /var/log/nginx/www.example.cc-access.log;
    include extra/*.conf;
    include conf.d/rewrite/thinkphp.conf;

    #------------- SSL Start --------------

    #------------- SSL End ---------------
    location /backhome
    {
    alias /data/wwwroot/backhome/public/;
    index index.php index.html;
    location ~ ^/backhome/.+.php$ {
    alias /data/wwwroot/backhome/public/;
    fastcgi_pass unix:/dev/shm/php-fpm-default.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /data/wwwroot/backhome/$fastcgi_script_name;
    include fastcgi_params;
    }
    include conf.d/extra/*.conf;
    }
    }
    在配置文件中加一个server

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 11月11日
  • 已采纳回答 11月3日
  • 创建了问题 9月3日

悬赏问题

  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误