php - 我如何在 CWP(Centos-Web-Panel)中使用 laravel 网站。网址中没有公用文件夹?
问题描述
嗨,我想更改服务器面板为 CWP 的网站的根目录centos-web-panel
。我找到了一个说 change DocumentRoot
and directory
in的解决方案,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
解决方案
您需要执行以下操作以在不公开的情况下指向您的应用程序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>
推荐阅读
- arduino - 当我使用字母“&”时,ESP32 writeStringEEPROM 添加了不需要的成员
- react-native - ReactNative AsyncStorage 返回奇怪的值
- javascript - 缓冲区中的 Blob 返回损坏的 pdf
- python - 从字典中迭代值以在 Pandas 中的列之间进行操作
- winforms - MyForm2:未声明的标识符
- python - 在 Python 中计算加速度
- c# - 选择每个导航属性的第一个
- google-forms - 根据电子表格和其他问题更改谷歌表单问题
- r - 使用 R 在宽数据中的列名中插入点
- python-3.x - 了解带有两个变量的 python 打印输出