Created
October 22, 2018 21:54
-
-
Save jpalala/0dfdb5b452031389e613e649b0ea43bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # composer | |
| curl -sS https://getcomposer.org/installer | ph | |
| # nginx | |
| `sudo mkdir -p /var/www/laravel` | |
| Next, we are going to modify the nginx's default configuration file: /etc/nginx/sites-available/default. But before that, just make a backup of the file: | |
| ``` | |
| sudo mkdir ~/backups | |
| sudo cp /etc/nginx/sites-available/default ~/Backups/default | |
| Use the following command to edit the file | |
| ``` | |
| `sudo nano /etc/nginx/sites-available/default` | |
| Next modify default to this: | |
| ``` | |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server ipv6only=on; | |
| root /var/www/laravel/public; | |
| index index.php index.html index.htm; | |
| # Make site accessible from http://localhost/ | |
| server_name <Your Domain name / Public IP Address>; | |
| location / { | |
| # First attempt to serve request as file, then | |
| # as directory, then fall back to displaying a 404. | |
| try_files $uri $uri/ /index.php?$query_string; | |
| # Uncomment to enable naxsi on this location | |
| # include /etc/nginx/naxsi.rules | |
| } | |
| location ~ \.php$ { | |
| try_files $uri =404; | |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
| fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| } | |
| } | |
| ``` | |
| Notice the difference: | |
| `try_files $uri $uri/ =404;` has been changed to `try_files $uri $uri/ /index.php?$query_string;` | |
| and location ~ \.php$ { ... } block has been added. | |
| Restart nginx. | |
| `sudo service nginx restart` | |
| # setup laravel | |
| sudo chown -R :www-data /var/www/laravel | |
| sudo chmod -R 775 /var/www/laravel/storage | |
| #troubleshooting | |
| throws errors for packages when creating laravel package? | |
| `sudo apt-cache search php7-*` | |
| and find the packages that it requires |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment