should i use public or artisan serve in production ?
hello , i have a app and i always when i upload the project i open it with /public/etc .... using htaccess i make it look like www.example.com without /public , but when i use any project from github the public directory have many problems like
The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/var/www/html/crm/crm/Laravel-Smarthr/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: file_put_contents(/var/www/html/crm/crm/Laravel-Smarthr/storage/framework/sessions/Czfh5l7sWAIZaT8O6K5Djaz3L75SdOaFaPo4jIgw): Failed to open stream: Permission denied Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}}
but when i run php artisan serve it's work correctly , so what i should do ?
This should indicate that no, it’s not suitable for production use.
Instead, as @sergiu17 mentions, you should configure your Apache or nginx site properly. You should set the document root to be your application’s public directory. Otherwise you risk exposing sensitive files like your .env file and configuration files.
@martinbean
thank you i was forgot the Apache config with
<Directory "/var/www/html/crm/crm/Laravel-Smarthr/public/">
Options Indexes FollowSymLinks MultiViews
Require all granted
Allow from all
Allowoverride All
</Directory>
and i get my answer is never use serve to production
@MahmoudAdelAli In addition to the above you need to set Document Root
DocumentRoot /var/www/html/crm/crm/Laravel-Smarthr/public/
<Directory "/var/www/html/crm/crm/Laravel-Smarthr/public/">
Options Indexes FollowSymLinks MultiViews
Require all granted
Allow from all
Allowoverride All
</Directory>