Laravel

Server Requirements

The Laravel framework has a few system requirements. All of these requirements are satisfied by the Laravel Homestead virtual machine, so it’s highly recommended that you use Homestead as your local Laravel development environment.

However, if you are not using Homestead, you will need to make sure your server meets the following requirements:

    • PHP >= 7.2.0
    • BCMath PHP Extension
    • Ctype PHP Extension
    • JSON PHP Extension
    • Mbstring PHP Extension
    • OpenSSL PHP Extension
    • PDO PHP Extension
    • Tokenizer PHP Extension
    • XML PHP Extension

Laravel

    • sudo apt install php7.2 libapache2-mod-php7.2 php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-zip php7.2-openssl
    • sudo apt-get -y install php7.0-mysql php7.0-mysqli php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache  php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext
    • sudo apt-get install php-mbstring
    • sudo apt-get install php-tokenizer
    • sudo nano /etc/php/7.2/apache2/php.ini

memory_limit = 256M

upload_max_filesize = 64M

cgi.fix_pathinfo=0

    • curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
    • cd /var/www/html
    • sudo composer create-project laravel/laravel laravel --prefer-dist
    • sudo chown -R www-data:www-data /var/www/html/                        
    • sudo chmod -R 755 /var/www/html/laravel/
    • sudo nano /etc/apache2/sites-available/laravel.conf

Then copy and paste the content below into the file and save it. Replace the highlighted line with your own domain name and directory root location.

<VirtualHost *:8080>   
  ServerAdmin admin@example.com
    DocumentRoot /var/www/html/MyProject/public
    ServerName example.com

    <Directory /var/www/html/MyProject/public>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the Laravel and Rewrite Module

    • sudo a2ensite laravel.conf
    • sudo a2enmod rewrite
    • sudo systemctl restart apache2.service

Then Add port

    • sudo nano /etc/apache2/ports.conf

## If you just change the port or add more ports here, you will likely also

# have to change the VirtualHost statement in

    • sudo /etc/apache2/sites-enabled/000-default.conf

Listen 80

listen 8080

<IfModule ssl_module>

        Listen 443

</IfModule>

<IfModule mod_gnutls.c>

        Listen 443

</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Then Next Step

    • sudo nano /etc/apache2/sites-available/000-default.conf

<VirtualHost *:8080>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/laravel/public
ServerName linuxsolustion.in

<Directory /var/www/html/laravel/public>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

======================================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *