PHP Classes

Laravel Nginx Configuration: Create a Virtualhost in nginx for a Laravel site

Recommend this page to a friend!
  Info   View files Example   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 46 This week: 1All time: 10,731 This week: 560Up
Version License PHP version Categories
larahost 1.0MIT/X Consortium ...5.5PHP 5, Systems administration, Libraries, C..., P..., C...
Description 

Author

This package can create a Virtualhost in nginx for a Laravel site.

It provides a PHP script that should be run from the command line shell to take a parameter of a given domain name.

The package calls a shell script to actually generate values for a Nginx Web server to make it ready to handle requests for the given domain with the current Laravel application being configured to run under that domain.

Larahost is the extended plugin written over the laravel/installer plugin to set up the nginx virtualhost for the application automatically while installing.

Innovation Award
PHP Programming Innovation award nominee
August 2019
Number 3
Many PHP applications are based on the Laravel framework use the Nginx framework.

This package makes it easier to configure a virtual host for a domain to run a Laravel based application by generating configuration files for the Nginx Web server.

Manuel Lemos
Picture of Ankit Jain
Name: Ankit Jain <contact>
Classes: 4 packages by
Country: India India
Age: 27
All time rank: 3297216 in India India
Week rank: 416 Up25 in India India Up
Innovation award
Innovation award
Nominee: 2x

Example

#!/usr/bin/env php
<?php

if (file_exists(__DIR__.'/../../autoload.php')) {
    require
__DIR__.'/../../autoload.php';
} else {
    require
__DIR__.'/vendor/autoload.php';
}

$app = new Symfony\Component\Console\Application('Larahost Laravel Installer', '1.5.0');
$app->add(new Ankitjain28may\Larahost\LarahostCommand);

$app->run();


Details

Larahost

Build Status Latest Stable Version Packagist

Larahost is the extended plugin written over the laravel/installer plugin to set up the nginx virtualhost for the application automatically while installing.

Installation

It requires nginx to be installed in the system.

  1. First, download the Larahost installer using Composer:

        composer global require ankitjain28may/larahost
    
  2. Download the nginx configuration and put it in the nginx virtualhosts folder according to OS. Make necessary changes in the file related to port and PHP FastCGI configuration.

    For example- It is `/usr/local/etc/nginx/servers/` for Mac.

        cd /usr/local/etc/nginx/servers/
        curl https://raw.githubusercontent.com/ankitjain28may/larahost/master/nginx_conf/example.conf -O
    
  3. Export these variables in $PATH.

        export NGINX_EXAMPLE_FILE='/usr/local/etc/nginx/servers/example.conf'
        export NGINX_DEST='/usr/local/etc/nginx/servers/'
    
  4. Once everything is setup, the `larahost` new command will create a fresh Laravel installation in the directory you specify.

        larahost new blog
    

    ## Contribute

>Feel free to contribute

License

>Copyright (c) 2019 Ankit Jain - Released under the MIT License


  Files folder image Files  
File Role Description
Files folder imagenginx_conf (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file larahost Example Example script
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file nginx.sh Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  nginx_conf  
File Role Description
  Accessible without login Plain text file example.conf Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file LarahostCommand.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:46
This week:1
All time:10,731
This week:560Up