Showing posts with label laravel. Show all posts
Showing posts with label laravel. Show all posts

Wednesday, April 24, 2024

Nginx : Deploy Laravel

1.Install Laravel

2.Edit parament in Nginx configuration

server {
        server_name example.com;
        listen X.X.X.X;
        root /home/example/public_html/laravel/public; <- change the active laravel folder
        index index.php index.htm index.html;
        access_log /var/log/virtualmin/example.com_access_log;
        error_log /var/log/virtualmin/example.com_error_log;

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
       
        error_page 404 /index.php;
       
        location / {
                       index index.php index.html index.htm;
                       try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ "\.php(/|$)" {
            try_files $uri $fastcgi_script_name =404;
            default_type application/x-httpd-php;
            fastcgi_pass unix:/run/php-fpm/1713861882126181.sock;
        }

        fastcgi_split_path_info "^(.+\.php)(/.+)$";
        if ($host = example.com) {
            rewrite "^/(.*)$" "https://example.com/$1" redirect;
        }

        # SSL Certiticate
        listen X.X.X.X:443 ssl;
        ssl_certificate /home/example/ssl.cert;
        ssl_certificate_key /home/example/ssl.key;
        rewrite /awstats/awstats.pl /cgi-bin/awstats.pl;
    }
}

3.Test nginx configuration

#nginx -t 

4. Restart nginx services

#systemctl restart nginx

 

Tuesday, May 25, 2021

Laravel : Install Laravel on Centos 7 and MSSQL connector

Install Composer
----------------
#curl -sS https://getcomposer.org/installer | php
#mv composer.phar /usr/bin/composer
#chmod +x /usr/bin/composer

Install Laravel
---------------
#git clone https://github.com/laravel/laravel.git
#cd /var/www/laravel
#composer install
#cp .env.example .env
#php artisan key:generate
#php artisan migrate
#chown -R apache.apache /var/www/laravel - if in hosting no to change
#chmod -R 755 /<path>/laravel
#chmod -R 777 /<path>/laravel/storage

Install node.js and npm
-----------------------
#yum install -y gcc-c++ make
#curl -sL https://rpm.nodesource.com/setup_15.x | sudo -E bash -
#yum install nodejs


Step to install MSSQL connector Centos 7
-----------------------------------------
# yum -y groups install "Development Tools"
# pecl install sqlsrv pdo_sqlsrv
# echo 'extension=pdo_sqlsrv.so' > /etc/opt/remi/php70/php.d/30-pdo_sqlsrv.ini
# echo 'extension=sqlsrv.so' > /etc/opt/remi/php70/php.d/30-sqlsrv.ini 

OR

Install the Microsoft ODBC driver for SQL Server (Linux) - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#redhat17 

To check version ODBC Driver
-----------------------------------------

# odbcinst -q -d
# odbcinst -q -d -n "ODBC Driver 17 for SQL Server"

Microsoft Drivers for PHP for SQL Server - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15