Change server in all URLs - paw-app

Using PAW and I have setup a bunch of test URLs for my API server. No I want to repeat all those URLs on my dev and staging servers.
Is it possible to do a search and replace on the server domain name to recreate the same tests for each server?

Unfortunately, there's no way yet in Paw to edit requests in batch.
The recommended way for fields that are likely to change (e.g. server hostname / base URL) is to set them in environment variables. See this documentation article: https://paw.cloud/docs/environments/environments-reusable-presets
Note: batch editing is for sure something that will come in future versions.

Related

AWS CloudFront + CloudFlare: Using Alternate Domain Names (CNAMEs)

I have the following setup:
- A WordPress Site hosted on hostgator.com
- DNS managed through cloudflare.com
- Amazon CloudFront used as CDN for Media, CSS & JS files (configured through W3 Total Cache WordPress Plugin)
On the pingdom.com Website speed test I get the message "This page makes 43 parallelizable requests to "mydomain.com". Increase download parallelization by distributing these requests across multiple hostnames." So this is what i'm trying to accomplish.
Amazon CloudFront is already working and serving files like this "1234567.cloudfront.net/wp-content/.../image.png". Now I want to parallelize hostnames and have something like "static1.mydomain.com, static2.mydomain.com etc."
I added those CNAMEs to my CloudFront Distribution and also to CloudFlare like this:
"static1.mydomain.com is an alias of 1234567.cloudfront.net"
I assume it should be working now or am I missing something?
CloudFront should serve files to any domain alias that is setup in the distribution 'alias' list section. Read the fine print to see how to separate between multiple aliases. Once you set it up and save, add the domain aliases to cloudflare and you should get the same file response on both aliases.
Note: in the last 12 months or so, we had significant improvements in how modern browsers fetch files and domain sharding is now considered a thing of the past.

2 Servers for website and media files (Wordpress Plugin Needed)

I am needing to host media files on one server (with a different domain name) and have my website (files) on the other. I have all Wordpress base websites and am needing all current files to be moved to the other domain/server. I cannot do this manually as there are over 10,000 media files all up. Is there any plugin that allows to do this? Or any other way to do this? I am doing this to reduce the average CPU load / memory requirement. Thanks
If you are having performance issues with WordPress, my first recommendation would be to make sure you are using a caching plugin such as WP Super Cache or W3 Total Cache (I happen to use the latter). You will need to use a persistent caching option as well for the best performance, such as Memcached.
I can only speak to W3TC, but it does have an option to server your static content via a CDN such as RackSpace CloudFiles. When configured properly it will move files from your media library to the CDN, and replace the links in your content to the proper URL.
If performance is your main interest, you should also look at serving your site via Nginx and php-cgi, managed through something like spawn-fcgi. There are some caveats to using Nginx vs Apache, but once tuned the performance is far superior. You can find a guide for the configuration on the WordPress site.
Lastly you can set up a reverse proxy from your front end server to point to static files hosted on a different server - the content just passes through your front end server. This can be accomplished using Apache or Nginx, but the performance will be better in the latter. Please see my site for an example of using an Nginx reverse proxy - you would just want to proxy requests for your static files location to a different back-end server.

How to PUT and POST image files to Apache2 using vhosts? (without PHP)

I want to simply POST and PUT image files to a server test.com, using apache2. This should result in storing the image file at the desired location. Lets say /srv/web/images/
What would be a working vhost configuration? Are there any modules that need to be activated? I am using apache2 on an ubuntu 12.04 server.
I think by default this is disabled in apache for obvious resons, nobdoy should be able to write to a server in the default configuration.
I want to simply secure it with http auth ("user1" / "pass1").
All the documentation and questions I find deal with PHP, but I thought should be possible using simply a REST URI and apache2 without PHP or cgi or a C program.
(Note: I am interessted in a solution without webdav (but I am not sure if the webdav module supports HTTP PUT which would be OK). And this question has got nothing to with forms or browsers, As an example the upload could use the program curl.)
Update: I found this message:
http://mail-archives.apache.org/mod_mbox/ant-ivy-user/201004.mbox/%3C4BBCA487.8000401#nitido.com%3E
It seems there once was a module mod_put, which is no longer in the repos of ubuntu. And that webdav has built in the functionality of PUT and DELETE.
If so, I am still unable to understand how to do the right VHOST configuration for simple FILE PUT operations.
I think nowadays for this kind of stuff you configure apache with WebDAV.

developing web app with subdomains

my application will have a subdomain per customer to show their logo and some other stuff:
company1.service.com
company2.service.com
I'm trying to see what's the best way to work during development:
configure the development machine HOST file to do some mapping, so I can access company1.localhost etc.
Use some kind of secret config flag which the app will check to determine what is the overriden domain
Do not use subdomains at all (even on production) and prefer query string
I think #1 should be ok for me just trying to see if anyone has bad experience with it or good with the other options.
I would use the first option because it is simple to setup and will reflect your target architecture. The third option is also simple to setup but it will differ from your actual scenario so you might need to make last minute changes before shipping which is never a good thing.

node.js serve a wordpress blog

I am using node.js on my rackspace server to serve my various applications. (Using node-http-proxy).
However, i would like to start a wordpress blog. The only way to serve the blog is via apache (or nginx).
Is there a way to server my wordpress blog from a node.js application itself?
You need some server running to execute the PHP. Node is JavaScript.
Whether that's apache, or nginx/php-fpm or just php-fpm, you need something to actually run the wordpress code, then use the same proxying system you are using now.
One option is to continue to use Wordpress as you normally do, but instead of writing the templates to output HTML, you make them output JSON. With this minor trick, you suddenly have created your own API to output your wordpress content. In contrast with the modules that expose wordpress complete set of methods, this will create your very specific output, tailored after your needs.
To consume your JSON output, you set up a small nodejs server that forwards each call directly to your Wordpress solution, takes the response (JSON) and merges it with your html using whatever javascript template engine you like. You also gain speed, since you can cache the JSON result pretty easily on the node side, and control.
I've written a blogpost about this if you like to read more, and also created a nodejs express middleware to help setting up the node side.
http://www.1001.io/improve-wordpress-with-nodejs/
You can try express-php-fpm package.
It combines Express (Node.js server) and FastCGI gateway to serve php requests.
I found this node module while searching for Wordpress + Node:
https://github.com/scottgonzalez/node-wordpress
I haven't tried it, though, but if you know what you're doing you might want to give it a go.
I recently needed to get a server within an electron app to serve PHP.
I started with grunt-php by Sindre Sorhus. The main change I made was to remove the code that kills the server process when grunt is done, instead instantiating the PHP class from JS and calling the process as needed.
Ultimately, it was very easy to adapt grunt-php to enable PHP on a node.js server.
WordPress now has an "official" (to be precise: open source, under Automattic's github repo) way to do this: wpcom.js. From that github page:
Official JavaScript library for the WordPress.com REST API. Compatible with Node.js and web browsers.
The essence is to call the WordPress REST API from JS.

Resources