Moving from nginx to Netlify or Github pages - nginx

We plan to move our static websites from dedicated servers running nginx to Netlify / Github Pages.
Currently we run nginx as our web server. Nginx allows our content to be organised in flat hierarchy as shown below and let us map each URL to the file system path like. For example,
/web/main -> for https://example.com/
/web/docs -> for https://example.com/docs/
/web/jsapp -> for https://example.com/app/
As I understand from the Netlify / Github Pages documentation, we may need to reorganize our content in deep hierarchy like following (please correct me here):
/web/main
/web/main/docs
/web/main/jsapps
Is this a correct understanding? if yes, we would like to avoid that. I hope that Netlify / Github Pages will have something to organize the url and content path individually like nginx does but I couldn't find anything other than redirect (which is not what I am looking for).
Any idea?
Thanks

Yes. Correct. Most of it will come down to reorganizing your static website in a specific structure. You will have to make sure you have an index.html at the root. If you plan on using something like Jekyll or Hugo or even Gatsby, that could help with pipelining assets, building URLS, etc. but moving a compiled static site will need to follow a specific structure. In the end, github pages hosts that and not the engine.
If you leave anything on the nginx too, say css, then you will need server side push too. A lot of variables there. Small ones however. Restructuring is anyway the better way to do it, if it is all static content.

Related

How to enable CDN for a subdomain with external web server?

My landing page is a static built website on Netlify.
Then I have a subdomain, which is an A record in DNS (set in Netlify).
This subdomain is points to an external web server (nginx+Django), which provides REST API and serves static content.
The question is how can I make this subdomain to use Netlify's CDN, when serving static content from Django API?
Are there any approaches to do it?
Netlify advises against using any CDN in front of it, as it already provides CDN. As well as there'll be a problem with SSL certificate.
I tried my best to look for such a question, but I couldn’t pick the right terms, I suppose, so I didn’t find it.
I would be very grateful for any advice!
Thank you and best regards!
You can use Netlify's Proxy Rewrites: https://docs.netlify.com/routing/redirects/rewrites-proxies/ to add some level of CDN to your site. However, it will totally be upto Netlify to decide how much time your content will stay in cache. If it's not in Netlify's cache, there won't be much of a performance boost by doing this - so I'd advise against it, unless absolutely necessary.

Using Root Relative URLS instead of Absolute to solve Wordpress Migration Problem

I'd like to solve the problem of not needing to change all links in a project when preparing to migrate from local to live. I'd like to avoid absolute urls altogether, and since relative urls on Wordpress doesn't look like a good way to go. I'd like to strictly use root relative links.
My current local Ampps Apache server is set up so that each Wordpress site has its own subdirectory. So I have root relative links that look like these:
/wp-pachira/wp-content/themes/pachira/resources/assets/scripts/pachira-critical.js
/wp-pachira/wp-content/uploads/2018/10/logo_1.3-05-01-01.svg
What I need is have all links without the wp-pachira subdirectory, like so:
/wp-content/uploads/2018/10/logo_1.3-05-01-01.svg
In attempt to solve this problem, I've tried to add a local domain called pachira.local in Ampps, making sure to modify my Windows hosts file. The domain works, as it points to my local ip as it should, but it still recognizes only the links with the /wp-pachira/ subdirectory.
I've also tried a different method of directly modifying the Apache config file, but no success.
Any suggestions?

Move wordpress installation from subdomain to root and keep links

ok this is bit weird question:
here is my domain: hfarazm.com
and wordpress installation at: blog.hfarazm.com
I have lots of visitors and they have shared my blog and article links all over.
I want to organize my site for separate section for tutorials, for blog, for portfolio and for other things.
Right now everything is going to blog.hfarazm.com i want to move blog to root but want to keep links so that users dont see 404 page and i get a chance to manage my site from the root.
I know: changing url in settings of wordpress will do the job but is redirecting is good practice? what is the better solution to achieve this confusing state.
You can create an .htaccess rules so your visitors will be redirected to new location, even if they type the URL blog.hfarazm.com.
See detailed information here.
Note that many of these examples won't work unchanged in your particular server configuration, so it's important that you understand them, rather than merely cutting and pasting the examples into your configuration.

Host static Wordpress blog on S3?

I have an old WordPress blog that I no longer use but want to keep the pages to support old incoming links. Right now I pay $20/mo for a t1.micro instance on EC2 just to run the stupid thing. I decided to use the Really Static plugin to extract the entire site in to static content with the goal to host it on S3's ability to host root domain content.
The good news is that the static export worked great. The bad news is that my URLs never used "clean URLs" and so the pages were stuff like http://example.com/blog/?p=123. The way the plugin works is that it exports a directory such as p=123 and then puts an index.html file in it.
My question is: does anyone have a bright idea on how (or if) I can host a URL like /blog/?p=123 and serve it from S3 using the static content I have? Even when I create a directory in S3 of ?p=123 I can only get /blog/%3Fp%3D123/index.html to serve while /blog/?p=123/index.html shows an access denied error.
Thanks!
http://www.slowping.com/index.html%3Fp=76.html discusses converting a wordpress blog to s3.
As you can see from the url, he's using the p= style of url. He seems to be using the directions from http://mossiso.com/2007/09/10/converting-wordpress-to-static-html.html though, so it may be that you just need to use a different converter.
Followup: Here's an article that discusses converting a custom themed wordpress install to octopress and it discusses some edge cases that may be relevant.
http://mrdanadams.com/2012/migrating-wordpress-custom-theme-octopress-jekyll/#.UUJxNltxuGo

Installing Magento and Drupal in the same directory... htaccess magic maybe?

We are looking to run one website using two CMS systems, so for all the content related stuff it would be drupal, and then for all the ecommerce related stuff, we are looking to use Magento.
Do you think this is possible? What are the general thoughts on this as an idea?
Usually we would have the ecommerce on a subfolder, like /store/productname... however, the client has specifically asked that we don't have it on a subfolder, hence asking for opinions on here.
Edit: For the sake of anyone thinking this is not programming related, I am wondering if there is something that you could achieve with the .htaccess file (rewrites etc).
I don't think this is really possible, both Drupal and Magento rewrite all incoming requests for non-existing files to index.php in the root.
I guess you could change one of the CMSs root files to index2.php and try to route requests for that CMS to the correct index file. However this means you will need to maintain a list of all paths that can be accessed by that particular CMS in the .htaccess file itself, which would be a real pain.

Resources