Skip to content

bibovaldez/sbioset

Repository files navigation

BiosecurityTech - Laravel Installation on Hostinger (Updated)

Prerequisites

  • PHP (>= 8.1)
  • Composer
  • MySQL
  • Git
  • Node.js and NPM

Step 1: Install Project Dependencies

  1. Install Composer dependencies:

    php ~/composer.phar install
  2. Copy .env.example to .env:

    cp .env.example .env
  3. Generate a new application key:

    php artisan key:generate
  4. Edit the .env file:

    nano .env

    Update the database settings and other necessary configurations.

  5. Install NPM dependencies and compile assets:

    npm install
    npm run build
  6. Clear the cache and optimize:

    php artisan config:cache
    php artisan config:clear
    php artisan optimize:clear
    php artisan cache:clear
    php artisan config:cache
    php artisan optimize
    php artisan storage:link

Step 2: Set File Permissions

  1. Change ownership of the project files:

    sudo chown -R www-data:www-data /path/to/your/project
  2. Change permissions of the project files:

    sudo chmod -R 775 /path/to/your/project/storage
    sudo chmod -R 775 /path/to/your/project/bootstrap/cache

Step 3: Configure the MySQL Database

  1. Login to MySQL:

    mysql -u your_username -p
  2. Create a new database and user:

    CREATE DATABASE biosetdb;
    CREATE USER 'bioset'@'localhost' IDENTIFIED BY 'bioset@2024';
    GRANT ALL PRIVILEGES ON biosetdb.* TO 'bioset'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

Step 4: Migrate and Seed the Database

  1. Migrate the database:

    php artisan migrate
  2. Seed the database:

    php artisan db:seed
  3. Clear the cache and optimize:

    php artisan optimize:clear
    php artisan optimize

Step 5: Create Symbolic Link

  1. Create a symbolic link from public/ to public_html:
    ln -s /path/to/your/project/public /path/to/your/project/public_html

Step 6: Final Steps

  1. Set up scheduled tasks: Add the following to your crontab (crontab -e):

    * * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
    
  2. Configure queue worker (if needed):

    sudo nano /etc/supervisor/conf.d/laravel-worker.conf

    Add the following configuration:

    [program:laravel-worker]
    process_name=%(program_name)s_%(process_num)02d
    command=php /path/to/your/project/artisan queue:work
    autostart=true
    autorestart=true
    user=www-data
    numprocs=8
    redirect_stderr=true
    stdout_logfile=/path/to/your/project/worker.log
    

    Then run:

    sudo supervisorctl reread
    sudo supervisorctl update
    sudo supervisorctl start laravel-worker:*
  3. Set up SSL (optional but recommended): Use Let's Encrypt for free SSL certificates:

    sudo apt install certbot python3-certbot-apache
    sudo certbot --apache -d yourdomain.com
  4. Final checks:

    • Ensure all services are running: PHP, MySQL
    • Check Laravel logs for any errors: tail -f /path/to/your/project/storage/logs/laravel.log
    • Test the application in a web browser

Remember to replace /path/to/your/project with the actual path to your project and yourdomain.com with your actual domain or server IP address where appropriate.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages