Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

laravel conf apache2

To install laravel v9 you will need apache2, php8 and composerv2 (Ubuntu 20.04/Ubuntu 18.04)
sudo apt update
sudo apt upgrade

Install and start apache2
sudo apt install apache2
sudo service apache2 start
Open: http://localhost:80
sudo service apache2 stop

Install php8
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.0 php8.0-cli php8.0-common php8.0-xml php8.0-curl
php -v

Enable mods
sudo a2enmod php8.0
sudo a2enmod headers
sudo a2enmod rewrite

Install composerv2
cd /home/user
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
compsoer -V

Install laravel project
composer create-project laravel/laravel example-app
php artisan key:generate --ansi
php artisan serve

Configuration file for apache2 example
cd /etc/apache2
sudo a2dissite 000-default.conf
cd /sites-available
sudo touch appName.conf

sudo nano appName.conf
Copy, paste and configurate:
---------------------------------------------------------------------------------
<VirtualHost *:80>
	ServerName name.local

    // If project is based on multiple env (admin/frontend)
	SetEnv ACTIVE_MODULE frontend
	
	DocumentRoot "pathDirectory/laravel/public"
	<Directory "pathDirectory/laravel/public">
	    Options Indexes FollowSymLinks MultiViews
	    AllowOverride All
	    Require all granted
	    Order allow,deny
	    Allow from all
	</Directory>

	ErrorLog /var/log/apache2/fileName.err
	CustomLog /var/log/apache2/fileName combined
</VirtualHost>
---------------------------------------------------------------------------------

sudo a2ensite appName.conf
sudo service apache2 restart
or
sudo service apache2 start
Comment

laravel apache2

# Laravel includes a public/.htaccess file that is used to 
# provide URLs without the index.php front controller in the 
# path. Before serving Laravel with Apache, be sure to enable 
# the mod_rewrite module so the .htaccess file will be honored 
# by the server.

# If the .htaccess file that ships with Laravel does not work 
# with your Apache installation, try this alternative:

Options +FollowSymLinks -Indexes
RewriteEngine On

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Comment

PREVIOUS NEXT
Code Example
Shell :: enable site 
Shell :: check port running 
Shell :: linux add alias 
Shell :: command prompt flashes and closes 
Shell :: ubuntu create bootable usb from iso command line 
Shell :: git pull rebase 
Shell :: bashrc sleep command 
Shell :: how to open directory in linux using command 
Shell :: gitignore file download 
Shell :: add git in project 
Shell :: what is kernel and shell 
Shell :: bash store pipe output in variable 
Shell :: github refs/remotes/origin/master do not point to a valid object 
Shell :: terminal shortcut ubuntu 
Shell :: how to run a command async in ubuntu 
Shell :: the current branch has no upstream 
Shell :: How do I revert a Git repository to a previous commit? 
Shell :: change default branch on git 
Shell :: upgrade powershell 
Shell :: ubuntu nvm 
Shell :: how to install snapd on ubuntu 
Shell :: aws cli stop rds instance 
Shell :: Malformed entry 2 in list file /etc/apt/sources.list.d/docker.list ([option] not assignment) 
Shell :: set ubuntu display landscape 
Shell :: terraform version command 
Shell :: Using git filter-branch to Git Change Commit Author 
Shell :: install rtools rstudio 
Shell :: download istioctl 
Shell :: windows cmd equivalent of grep 
Shell :: rsync as sudo 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =