How to configure Nginx for serving Symfony2 app from location path? - symfony

No problem for me to setup a normal domain or vhost. But I don't get it right to serve from a different directory via location!
Wether the Symfony cookbook site nor the nginx symfony wiki page mention this scenario.
I walked throug several hints from Stackoverflow and elsewhere - but no success.
Is there any resource or working configuration someone can provide me?
Some information:
Symfony root web folder is not a sub folder of webroot; i need to setup a path like /admin for several domains directing to a separate Symfony folder:
Web Root for the domain (differs on domain):
/srv/http/domain.com/htdocs
Symfony web root for all domains accessible with /admin
/srv/http/shared/admin/web
Thanks in advance,
Micha

Related

Symfony setup directory on cloudways

I want to set up symfony3 on cloudways. Path for application folder is /home/master/applications/[appName]. pwd in this dir: conf logs private_html public_html ssl tmp.
As this link says I should install symfony application in public_html. However, I know that public_html is the same as web. So an application should not live in that folder. So, I think to install folder directly in /home/master/applications/[appName] and change 'web' directory to public_html. Is that right? Do not other existing folders (conf, logs) interfere symfony app?
Update: I am going to setup a git repo for symfony app on server. So if symfony should be installed in public_html/../ then all other files also will be tracked by git. I do not think that ssl should be tracked. Sure, I can add it to gitignore, but anyway.
I am from cloudways. Let me tell you the whole process, Cloudways is a managed hosting so there are some restrictions. You can't install symfony in: /home/master/applications/[appName]. You need to move in Public_html which is not a typical public directory. Install Symfony in this folder and don't worry your other files are not exposed beside the web folder. Every file is securely hidden and the whole process is also tested by Symfony officials.
After installing symfony in public_html folder, you can point out the URL to web directory:
Again nobody will have access to your files they are protected.
You can add .gitignore file to avoid unusual files to be tracked. I created some tutorials you can take guidance from them. here is the URL: https://www.cloudways.com/blog/php/symfony/.
The web directory is the directory Symfony is served out of via the frontend controller app.php (or app_{env}.php for non-prod). This is separate in philosophy from where your web server serves from (apache, nginx, etc). The directory structure ultimately doesn't matter much in either case so long as you point your web server to the correct directory where your frontend controller lives.
This is a good starting point: http://symfony.com/doc/current/setup/web_server_configuration.html

Hosting Laravel 5.3 application on server

I build a Laravel 5.3 application on my local environment and now i want to deploy it on my hosted server.
On my server i already have a hosted Wordpress site. Actually i developed an application on Laravel and i want to host this on particular domain path.
for example suppose my Wordpress site is hosted on example.com
and i want to host my Laravel application on example.com/my-laravel-app
without affecting the Wordpress site
so how can i do this please help me and thanks in advance.
If you have in your public html directory a folder called "my-laravel-app" Wordpress will not try to serve it for you and it'll go directly to this folder.
You need to make sure that you point anyone who is visiting this directory to /public for laravel app to work (Or use any other question on SO like this one for ignoring the /public path which is not recommended at all!).

How to setup error page handling for subdomains?

On my hosting server I want to achieve the following arhitecture of main site and subdomains:
www.site.com
subdomain1.site.com
subdomain2.site.com
All three domain have some common resources: scripts, css files, images and custom error files to present errors like 404, 503 in a creative intriguing and most entertaining way.
I have organized folders on my hosting server into this structure
www-main
www-subdomain1
www-subdomain2
shared-css
shared-errors
I have setup each subdomain as an asp.net applicatin which resides in its physical folder.
To access common shared resources I have created virtual folders for each subdomain that point to the sam physical folders.
virtual folder shared-css in subdomain1 points to shared-css physical folder
virtual folder shared-css in subdomain2 points to shared-css physical folder
This works ok. But not for folder containing error files. I have configured my web.config and files according to http://benfoster.io/blog/aspnet-mvc-custom-error-pages
The problem is that it does not work for subdomains. If I configure virtual folder as asp.net application it complains it cannot load assemblies for the application for which this folder was created. On the other hand if I configure it as ASp folder it simply does not work.
This same concept works if site is not divided into subdomains but into subfolders instead of subdomains.
Does anybody has a working solution for this problem?
Not suggestions, I have tried many things, anything I could think of.

Redirect root to sub domain on IIS .NET Application

I have an ASP.NET Application that is configured for root. But on my web server I want to run it on a sub domain like dash.site.com/app
So i would like all URLs such as /home.aspx to remap to /app/home.aspx. In my code i have references such as ../ this maps to root of the site whereas its an asp.net application that is hosting so ../ should point to the root of the application not the site hosting the application.
I believe this can be done in URL rewrite but could not find a regex to accomplish this.
Can someone please point me in the right direction?

Configuring Asp.NET Application in subfolder - Without IIS config

I have a free hosting account, and two ASP.NET project.
I want to upload both apps in my hosting, like:
www.hosting.com/myaccount/project1/
www.hosting.com/myaccount/project2/
But the problem is when I run project1 or project2
Asp.net considers application main path ("~") as root www.hosting.com/myaccount/
Si I cant load dll, App_themes, and Other.
What can I do to stop that strange behvior!
I cant configure IIS because I am using free hosting.
I applied this answer and no thing happened.
Thank you for hepling.
You can add an application at root that redirects to the other two.

Resources