I want to create some project and use there Laravel as API and Angular 4 to represent my site.
Since I have no money for experiments, I found hostinger.co.uk where I can set up php framework and do that I need.
I started configuring Laravel and get confused - where to place my site on angular? I'll have the only one site address. So I'd like to make it combined, because I need Laravel the only for working with DB.
Best practice would be to keep api & frontend seperate.
If you insist on using single domain, such as example.com you can use subdomain api.example.com for API, and main domain for presenting your site.
On a shared hosting you can place folders something like these:
/api -- laravel installation(with subdomain api.example.com)
<angular build files>
index.php
script.bundle.js
style.bundle.js
etc.
......
.....
.....
.....
For development you can keep your angular files anywhere on your local system, and upload only build distribution to the main domain.
Related
I need help in creating a redirect.
Our Current Setup:
We have a mobile app that accesses the API via https://ourwebsite.com/oldapi/mobiledata
We have moved to a new webserver and need the API path to stay the same.
On the new server, Wordpress lives at /var/www/html/webserver.com/public which resolves to https://ourwebsite.com and the Apache2 Document root
points to /var/www/html/webserver.com/public
Laravel has been installed on the webserver at: /var/www/html/webserver.com/laravel/ which is one folder below the Document root
A symbolic link has been created in /var/www/webserver.com/public/hq/ to point to /var/www/html/webserver.com/laravel/ so the Laravel App can be accessed by visiting: https://ourwebsite.com/hq/
Note: Another Symbolic link has been created for the laravel storage at /var/www/webserver.com/public/hq/storage which points to /var/www/html/webserver.com/laravel/storage/app/public
The new Laravel API endpoints are accessed at https://ourwebsite.com/hq/api/v1/
The Question
We need to preserve one particular endpoint1, and have its route be: https://ourwebsite.com/oldapi/mobiledata
Here is where I am confused. Since Laravel lives in https://ourwebsite.com/hq/ and Wordpress lives at https://ourwebsite.com, how can we set up the .htaccess so that the laravel route in /var/www/dux.city/laravel/config/api.php
I am guessing I need some fanciful .htaccess in the Wordpress route at /var/www/html/webserver.com/public
I'm a newbie to Laravel projects but I need to have one accessible over the internet so I tried using DirectAdmin but whenever I go to my domain I get an index (pictures attached).
I renamed the Laravel 'public' folder to 'public_html', is that correct? Here is my file structure.
Here is what I get when I go to my assigned domain which isn't my website at all.
The webpage should look something like this
I also found a laravel app using Softaculous linked here (https://panel.freehosting.com:2222/CMD_PLUGINS/softaculous/index.raw?act=software&soft=419). Am I required to use this app?
At first, you need to learn about the laravel directory structure. You don't need to change the laravel public folder to public_html. I am not sure how the DirectAdmin server works. but if you see a laravel directory instead of serving an application it's might be a path-related issue in your server. your domain should serve your application public folder.
I just found a tutorial for the DirectAdmin server with laravel. that might help.
I have developed a news website project using laravel 8x for one domain(main domain) Can I use the same project in subdomain? Main domain project frontend will Bangla language and the subdomain project frontend will English. Is it possible? or do I have to install new Laravel apps for the subdomain project?
Also, database will be different.
Hi There of course you cant use different databases for same Laravel Project unless you make separate installation for each domain and its subdomain.
Indeed You can use localization in Laravel so you will not have to install 2 copies for the same app
More details about localization here : https://laravel.com/docs/8.x/localization
I need a bit of expert feedback on this please as I do not want to start my project in the wrong way.
I would like to keep my Vue code separated from Laravel, the reason being, I may use this vue app later on on Cordova.
First question:
I understand how to host the Laravel API and Vue app on 2 different domains, no problems at all but I am unsure on how to setup the folder when both apps are on the same domain.
I know that Laravel should be hosted below the public_html folder and have a symlink to the public folder for security purpose. But where should my vue app goes?
Second question:
When I save images from Vue(as I am creating a blog) the images are going to the Laravel store/images folder, so each time I want to show an article in my vue app, the API must each time request the content(text and images) from the Laravel API, is this fine? Will the Google bot be able to trigger the API request when requesting the content?(I actually never thought of this...)
Thank you so much!
I am kinda stuck in my laravel 5.2 application (I'm actually a newbie in Laravel). I am working on a project with both front and back ends. The two ends are hosted on two different domains (frontend on the main domain and backend on a subdomain). The problem is, am trying to upload files (images) from the backend on the subdomain to a folder on the main domain. I have made extensive research on how to do this to no avail. Hoping to get assisted. Thanks.
Try to make the upload form on the same server that the request is procesed and try to include the form on the other server using an iframe or something similar.