简体   繁体   中英

How do i hide my .env in laravel and Deploy Laravel Applicatio

I don't want the file in my root directly to be hidden that include .env file of laravel maybe with .htaccess or any other way i have am trying to host it bt i don't want some to go to mysite.com/.env

APP_ENV=local
APP_KEY=base64:w8nPcK6CVaazC/WEv42hf+QOs4zWg2izt1pubH0KnQE=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306

I have this error from my server.

PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/skycashs/public_html/public/index.php on line 50

You need to point web server (Apache or nginx) to the public directory which is inside Laravel project root

You're using wrong web server configuration. Point your web server to a public directory and restart it.

An example for Apache web server:

DocumentRoot "/project_root/public"
<Directory "/project_root/public">

And for nginx:

root /project_root/public;

Don't forget to restart web server to make changes work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM