How to make Azure App Service Web Apps serve my website out of my repoRoot/src/views/ folder as the website root? - azure

In one of my git repos, I've got a simple HTML website with the following folder structure:
repo root:
--reference
--developer-notes.txt
--i-am-not-website-code.txt
--i-am-not-meant-to-be-served-by-web-server.txt
--etc.txt
--src
--views
--index.html
--etc.html
--content
--foo.css
--etc.css
--images
--foo.png
--etc.png
--scripts
--foo.js
--etc.js
I just created a App Service Web App on Azure, configured it to pull the source out of my repo, and deployed it.
I made sure that the Application Settings -> Default Document list had an entry for the index.html file.
However, as understood, due to my folder structure, I can only view my website if I go to:
foo.azurewebsites.net/src/views/index.html
I cannot go just to:
foo.azurewebsites.net/
and see my index.html page.
Now, I can change my folder structure by putting my HTML pages in the root, to make the website appear at foo.azurewebsites.net/. But I was wondering if there was a way to not have to do that, esp. given that every repo also stores stuff other than the source code, for example in my case the Reference folder, and most repos have the source, which only one of the many artifacts, in the source folder.
Is there?

One thing you can do is to change the virtual path for your root application to point to your views folder in the Virtual applications and directories section of your Application settings. That way you will have foo.azurewebsites.net/ serve your index.html file.
Another thing you will have to do in this case, is to set the virtual application paths for your content and scripts folders (and the reference folder if you need to access it's content from the web) since they are not under your views folder.
Given your folder structure, it would look something like this:

Related

I'm using tailwindCSS for a simple html site but deployment on netlify does not work, why?

I've been learning how to use tailwind css by following the offical video tutorial and I just wanted to try to deploy the site example to Netlify to see if it works using the drag and drop feature.
This means taking the entire project folder and dumping it into netlify. This usually works with vanilla html css js sites but for some reason I get the error
Page Not Found Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
This is how the project structured looked like:
What am I doing wrong? Inside the build folder there is another file called tailwind.css
On your Netlify dashboard, change the publish directory to the directory where your index.html file resides: public/. That should do it.
You can also, as you said, take everything out of the public folder and put it at the same level as the other folder and files, which makes the index.html available at the root of the project. However, then you lose your project's file organization.
I've fixed the problem.
The trick was to take everything out of the public folder and put it at the same level as the other folder and files.
This would make the index.html file available at the root of the project and would allow the site to work properly once deployed.

Adding additional html pages beyond index in azure web app.

I created a web app on Azure. I am having issues adding additional html pages beyond an index. Is there something I'm missing? I've been searching to no avail.
Looks like you want to define your own start page name for the web app.
Files added to root path(aka wwwroot folder in kudu) can't be accessed with https://webappname.azurewebsites.net unless you set Default document in Application settings. Just add your file name in the list. The first matching file in the list is used.
If your page is deployed to a folder under root path, you also need to set Virtual applications and directories(also in Application settings). Change the physical path value from site\wwwroot to site\wwwroot\foldername.

How can I move my old sites from shared host server to VPS?

I'm sure a lot of you guys used to be in the same situation as I am at right now.
Before
I used to owned shared hosting for about 2 years.
I kind of get used to it, whenever I create a new site.
I just need to upload my entire new folder including : index.html , styles, scripts, and other assets via FTP into the root directory to my shared host server. Then, I go to the url of that folder, I will see the site loaded, that's how I normally do it.
Now
I upgrade the way I host my site. I just recently purchased a VPS on Digital Ocean, and run Laravel application on it. Now, the site is way faster, and I have more control.
Unfortunately, I'm not sure what to do with all my old sites that I used to have.
How do move them into my new VPS ?
How do I go to them ? How is that work ?
Should I create a public_html folder or something ?
How can I achieve something like this ?
Any direction on this will be much appreciated !
Depending on your setup (single domain, multi-domain). If you're dealing with a single domain environment you'll just move everything over like normal. If you're in a multi-domain environment you'll need to point all your domains to the new server and setup different apache sites (config files) that point to their respective locations on disk.
In my experience with multi-domain environments and Apache 2.4 it's best to have /var/www/ be your center where you can store your .htpasswd or any other files like that, and a folder named public which has your outward facing websites in their subfolders.
Example:
web1.com would exist in /var/www/public/web1.com/...
web2.com would exist in /var/www/public/web2.com/...
You could alternatively have another public folder, but if you're specifically asking about laravel you'd want to point the apache config to the public directory as if you go any higher people have access to your .env file.
If you have everything in your single domain environment (public_html) and you now have a laravel site at your root you could alias a specific path to act as your "old site" data that points to a different folder than your laravel install.

How can I set the root folder for an Azure Websites site?

My folder structure is like so:
-build
-unimportant stuff
-src
-scripts
-thirdParty
-knockout
-knockout.js
-jquery
-jquery.js
-business
-application.js
-index.html
So, basically I have my entire site source inside a "src" folder, when I deploy that to Azure I have to change the default pages configuration to "src/index.html" which seems to work. My problem is that my scripts are not being loaded.
I have my scripts referenced like so:
In my local environment this works great, but it Azure it is not able to access the scripts. It seems that even though I am trying to use relative path, Azure is trying to access the scripts from it's root directory which is one level below where the scripts are.
Does anyone know how to change the Azure Website root directory to be set as my "src" directory
the solution is to go to "Configure" in the management of your Azure Website. In the "app settings" section add a key of "Project" and a value in my case of "./src" then trigger a deployment. now only the directory you specified will be deployed and it will be deployed as the root.
Full instructions can be found here: https://github.com/projectkudu/kudu/wiki/Customizing-deployments

Access file in weblogic server

Is there a folder in the Domain Directory of Weblogic, where files put inside can be accessed directly from web browser? In other word, I don't have to pack the file in an ear, war file and deploy it to make it accessible?
Thank you very much
Regards
K.
The Virtual Directory Mapping feature (that you declare in the weblogic.xml) would do the trick:
Using the virtual directory mapping
feature, you can create one directory
to serve static files such as images
for multiple Web Applications. For
example, you would create a mapping
similar to the folowing:
<virtual-directory-mapping>
<local-path>c:/usr/gifs</local-path>
<url-pattern>/images/*</url-pattern>
</virtual-directory-mapping>
A request to
http://localhost:7001/mywebapp/images/test.gif
will cause your WebLogic Server
implementation to look for the
requested image at:
c:/usr/gifs/images/*.
This directory must be located in the
relative uri, such as
"/images/test.gif".

Resources