首页 > 解决方案 > 我如何在 CWP(Centos-Web-Panel)中使用 laravel 网站。网址中没有公用文件夹?

问题描述

嗨,我想更改服务器面板为 CWP 的网站的根目录centos-web-panel。我找到了一个说 change DocumentRootand directoryin的解决方案,httpd.conf但我无法更改它,因为我的很多网站都使用此服务器。我想更改我的一个网站中的根文件夹。另外,我找到了另一个解决方案,它说编辑文件。

# nano /etc/httpd/conf.d/your_site.conf

并将此代码添加到文件中

<VirtualHost *:80>
DocumentRoot /var/www/html/your_site/public
ServerName your_domain

<Directory /var/www/html/your_site/>
AllowOverride All
</Directory>
</VirtualHost>

但不工作。我该怎么做?有任何解决方案或使用.htaccess或自己的laravel模板吗?

所以我想/public_html//public_html/public/centos-web-panel 使用 Nginx更改in i

标签: phplaravel.htaccessnginxcentos-web-panel

解决方案


您需要执行以下操作以在不公开的情况下指向您的应用程序URL

将您的 server.php 重命名为index.php并从公共文件夹复制您的.htaccess文件并将其平行粘贴到index.php(以前是server.php

要隐藏您.env的文件,您需要在.htaccess文件中添加以下行

# Disable index view
Options -Indexes

# Hide a specific file
<Files .env>
    Order allow,deny
    Deny from all
</Files>

推荐阅读