403 forbidden when deploying symfony application on a Shared Web Hosting - .htaccess

I'm trying to deploy my symfony app on a Shared Web Hosting server, so without any SSH access.
I've followed this tutorial : https://medium.com/#runawaycoin/deploying-symfony-4-application-to-shared-hosting-with-just-ftp-access-e65d2c5e0e3d
But i've done until the end and my homepage returns me just a 403 error, and every other url gets me a 404.
It looks like i've got to modify my .htaccess file, but apache-pack doesn't create one for me and the things i've found on internet doesn't work.
Does anyone can help me ?
Thanks

Related

Forward request to virtual directory to an internal web server using IIS7 URL Rewrite

I have an IIS server that is currently only accessible internally to our network and I would like to be able to access some files on it via a folder on our public website.
I would like it to work like the following:
user requests http://www.example-1.com/server2/[filename] from IIS server 1
Server 1 retrieves the file from the internal IIS server 2 at
http://www.example2/[filename]
Server 1 IIS then sends the file to the user.
NOTE: User CANNOT access http://www.example-2.com/[filename] directly. Only the first IIS server has access.
Here is the steps I have taken to do this:
I created a virtual folder in the root of our public website named "server1"
I then selected URL Rewrite in the IIS manager on this new virtual folder
I then created the rule as shown below:
I am currently recieveing a 404 error when I try to access a file at:
http://www.example-1.com/server2/test.jpg
I can verify the file is there by remoteing into web server one and browsing to:
http://www.example-2/test.jpg
This shows the test image.
I feel the problem must somehow be related to my URL rewrite rule.
If someone could offer advice on this issue I would greatly appreciate it as I have never used the URL Rewrite module before.
Thank you!
I have found the solution!
I was very close but I made a key mistake...
Instead of using a Blank Rule I needed to use a "Reverse Proxy" rule in IIS 7 URL Rewriting.
I created this Reverse Proxy rule on the /server2/ folder.
This works perfectly!

IIS reverse proxy not working in Azure Web App

I want to use a reverse proxy to point one of my endpoints to a resource that's hosted elsewhere. My primary server (where everything else is hosted) is in an Azure Web App and is otherwise working perfectly.
I've been using this seemingly failproof article along with the other links mentioned at the bottom of it: https://blogs.msdn.microsoft.com/zhiliang_xus_blog/2016/01/19/build-a-google-reverse-proxy-site-on-azure-web-app-in-less-than-3-minutes/
As a baseline, I used a Web App with no additional code and confirmed that the reverse proxy works. This was done by manually creating/editing the web.config file and applicationHost.xdt file then restarting the server.
I've tried 3 separate approaches (all on clean, new web apps) all of which are failing for me:
Push my code, confirm it works, then follow the reverse proxy steps manually
Follow the steps manually, confirm reverse proxy works, then push my code
Put the reverse proxy files into my codebase and push everything at the same time
None of these 3 approaches are working. Is this a bug in Azure? How can I try to figure this out?
Post XML Transformation (XDT), have you restarted the site?
I would suggest you to take a look at this blog from Ruslan:
http://ruslany.net/2014/05/using-azure-web-site-as-a-reverse-proxy/
It talks about using a Site extension. It implements the reverse proxy and it does the XDT transformation for you.
If the above is setup correctly, then there is something wrong with the URL Rewrite rules. I would recommend you to enable Failed Request Tracing and debug this further.
The link/way you posted used URL Rewrite to implement a reverse proxy. I tested it and it worked fine with my empty web application. After published a web application to the Azure Web App(For example, an ASP.NET MVC web application), the URL Rewrite stopped working. The reason is that all the requests to your web application are routed by ASP.NET route module.
To enable URL Rewrite for some URLs, we need to disable ASP.NET route for these URLs. For example, if you want to rewrite all the requests with "product/xxx" format to another site. You could add following code to RouteConfig.cs file.
routes.Ignore("product/{action}");
The problem in this specific case was the location of my web.config file.
It needs to be in the root directory of the application which, in my case, was not site\wwwroot. My code was being generated and copied into site\wwwroot\dist. Putting the config file in that directory fixed the problem.
Additionally, there are logs that can be enabled to get some insight as to what's going on: https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-enable-diagnostic-log

How can I host Laravel web application and other regular sites on the same VPS/Server?

I have a VPS in Digital Ocean, and I'm currently host Laravel web application on it.
It work great and pretty happy with the result so far, and here are my VPS details.
OS : Ubuntu
Installed : PHP, MySQL, and NGINX
I have a lot of html [index.html] and I want to also host my them in that same VPS/sever. I'm not sure where to start or what is the best way of doing it. I notice that there is a /var/www/html directory in my VPS, should I throw my index.html in there ?
I tried throw about index.html in there, and when I tried go to them in URL, I got 404 error from my laravel application.
No idea now...
Laravel Web Application URL
www.my-site.com/
Other sites URL
www.my-site.com/site1
www.my-site.com/site2
www.my-site.com/site3
How do I do that ? I've been researching about this for a couple days now, I didn't get any good results so far.
Any direction on that will be much appreciated !

Why is IIS giving 403 with single quote in URL?

I have an ASP.NET (version 4) MVC 3 application running on IIS 7.5. Anytime there is a single quote in the URL, for example http://devserver.com/myapplication/Home?filter=id~eq~'123' - I get a 403 Forbidden error.
Specifically, this happens when I'm using a Kendo UI grid and am trying to filter one of the columns. But I found that anytime a single quote is in the URL, IIS immediately gives the 403 error.
I've looked in the IIS logs and the event viewer and there is no indication anywhere of a 403 response - I can't seem to find out specifically why the 403 was given.
It's not IIS, it's Siteminder! We have Siteminder in front of our web application, and Siteminder intercepts all incoming traffic for authentication. In this case, Siteminder will also disallow a URL with a single quote in it. Although the 403 error looks like it's coming from IIS, it's really coming from Siteminder.
This issue happened for my app as well and the culprit is Siteminder in my case.
They have a set of BadCSSChars lists which would be validated against our URL. If any bad character is found, the URL will be blocked and wont reach IIS.
Siteminder can remove the 'character needed' exception in the agent.log file (not an expert in this, but heard that this file which stores badcsschars list) in the app server.

IIS 7 cannot display http://localhost

I am having a torrid time trying to figure out why I cannot display http://localhost in the web browser.
I keep getting the 404 not found error. I tried looking in the wwwroot folder and added the http://localhost/iisstart.html still nothing happened.
There is a web service and a web application added to the default web site and I am not sure if this has something to do with this but all this worked fine previously.

Resources