Skip to content

Commit ae9cd80

Browse files
committed
Add instruction guide.
1 parent f7a674f commit ae9cd80

File tree

1 file changed

+68
-3
lines changed

1 file changed

+68
-3
lines changed

README.md

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ For a quick version of the guide (many of you might already read about it), read
66

77
## Requirements
88

9-
Before trying to deploy a Laravel/Lumen application on a shared hosting, you need to make sure that the hosting services provide a fit [requirement to Laravel](https://laravel.com/docs/5.2#server-requirements). Basically, they are the following items:
9+
Before trying to deploy a Laravel/Lumen application on a shared hosting, you need to make sure that the hosting services provide a fit [requirement to Laravel](https://laravel.com/docs/5.2#server-requirements). Basically, following items are required for Laravel 5.2:
1010

1111
* PHP >= 5.5.9
1212
* OpenSSL PHP Extension
1313
* PDO PHP Extension
1414
* Mbstring PHP Extension
1515
* Tokenizer PHP Extension
1616

17-
Next, you need to have the SSH access permission for your hosting account; otherwise, none of these will work.
17+
Well, it also depends on the Laravel version you want to try to install, checkout the appropriate version of [Laravel server requirements documentation](https://laravel.com/docs/master).
18+
19+
**Next, you need to have the SSH access permission for your hosting account; otherwise, none of these will work.**
1820

1921
Besides PHP and those required extensions, you might need some utilities to make deployment much easier.
2022

@@ -25,7 +27,70 @@ I guess that's enough for good. Please refer to below sections to learn more abo
2527

2628
## Instruction
2729

28-
TBU.
30+
Let's get started by understanding how we should organize the Laravel application structure. At first, you will have this or similar directories and files in your account,
31+
32+
```
33+
.bash_history
34+
.bash_logout
35+
.bash_profile
36+
.bashrc
37+
.cache
38+
.cpanel
39+
.htpasswds
40+
logs
41+
mail
42+
public_ftp
43+
public_html
44+
.ssh
45+
tmp
46+
etc
47+
www -> public_html
48+
...
49+
```
50+
51+
For the main account which tied with the main domain, the front-end code should stay in `public_html` or `www`. Since, we don't want to expose *Laravel things* (such as, .env, ...) to the outside world, we will hide them.
52+
53+
Create a new directory to store all the code, name it `projects` or whatever you want to.
54+
55+
```
56+
$ mkdir projects
57+
$ cd projects
58+
```
59+
60+
Alright, from here, just issue a git command to grab the code,
61+
62+
```
63+
$ git clone http://[GIT_SERVER]/awesome-app.git
64+
$ cd awesome-app
65+
```
66+
67+
Next step is to make the `awesome-app/public` directory to map with `www` directory, symbol link is a great help for this, but we need to backup `public` directory first.
68+
69+
```
70+
$ mv public public_bak
71+
$ ln -s ~/www public
72+
$ cp -a public_bak/*.* public/
73+
$ cp public_bak/.htaccess public/
74+
```
75+
76+
The hard part is done, the rest is to do some basic Laravel setup. Allow write permission to `storage` directory is important,
77+
78+
```
79+
$ chmod -R o+w storage
80+
```
81+
82+
**Edit your `.env` for proper configuration. Don't miss this!**
83+
84+
Lastly, update the required packages for Laravel project using **composer** and add some necessary caches,
85+
86+
```
87+
$ php composer install
88+
$ php composer dumpautoload -o
89+
$ php artisan config:cache
90+
$ php artisan route:cache
91+
```
92+
93+
**Congratulation! You've successfully set up a Laravel application on a shared hosting service.**
2994

3095
## FAQs
3196

0 commit comments

Comments
 (0)