I have a VPS with Centos 7 and Apache 2.4. This server acts as a backend data source for a mobile app. Periodically new data files with unique file names are generated, after which they are never changed. I am looking for the best way to get Apache to cache these data files in memory without restarting the server each time a datafile is generated. Thank you in advance for your help.
In apache 2.4 you could use the mod_cache module. More infos about this on the official apache website:
https://httpd.apache.org/docs/2.4/caching.html
Not sure I understand the "without restarting the server each time a data file is generated" part!
Related
I have an Angular2 app that I've been developing for a bit now. Locally I run an Nginx server but the deployment server is using Apache. To unify things I worked to move the deployment server to Nginx but I am getting extremely slow results with Nginx.
Apache loads in ~5 seconds (1.1MB transferred)
Nginx loads in 16-20 seconds (5MB transferred)
These are both on the same server pointing to the exact same directory. The actual size of main.bundle.js is 4470365 main.bundle.js so it seems Nginx is loading the entire file.
How is Apache able to download only 737K?
You can check for the features enabled in both the files with nginx and apache by clicking on the exact file in Inspect element Network Tab. Then go to Headers and then Response Headers as illustrated in the attached image.
Check if the gzip compression is enabled in any one of the server. That is the only reason for lesser file size.
According to my client requirement every time a user register to software we need to provide a separate URL. For that we are using apache and registering the new url in apache httpd.conf. Now the issue is after every new url entry we need to restart the apache server to reflect the changes. But this approach is bad because restarting the apache server also effecting the existing client. So, I would like to reflect the changes without restarting.
So, an any one help me to do that with apache.
I am also open for other tools if that can solve my issue.
Apache can't update it's configuration without restart (graceful or clean).
It's a bad idea to store generated URLs in Apache config.
Much better is to use rewrite maps or store URLs in database and rewrite them with mod_rewrite
I'm running apache 2.2.24 on Max OS X 10.9.1. Currently, we have a network drive that we access all of our Git repos on at /Volumes/GitWebsites. I would like to configure Apache to serve our PHP based repos from that directory. So, localhost (or 127.0.0.1)/phpsite1/ or /phpsite2? etc. will serve sites from /Volumes/GitWebsites/phpsite1/ or /phpsite2/ in the browser. My two questions are:
Do I simply modify the server root or do I need to use the mod-alias in the httpd.conf file?
What are the permission setting I need to in order for apache to access /Volumes/GitWebsites ?
I've done configuration changes like this in IIS 7.5 and set up a NodeJS dev environment but still new to make large scale changes to Apache. Thanks for any help given.
If you are happy with serving the contents of /Volumes/GitWebsites as it is then it should be fine to point the document root at it. It's also makes it easy to add sites later.
However this could be troublesome later if you want to manage php configuration later on for the sites separately.
I have installed apache tomcat server on my machine for hosting some servlets. Now I want to put some files on this server so that user can download these files straight away. My question is is it possible to do this ? I mean can apache tomcat server act as a http server as well ? If yes, in which directory in tomcat server I should put these files ?
Please help,
Several pointers (from Google):
http://denis-zhdanov.blogspot.com/2009/08/configure-tomcat-static-content.html
Stackoverflow: How to serve static content from tomcat
Enable the file listing in conf/web.xml and then delete all the files in webapps/root directory and replace it with the files you want to transfer.
The below link could be helpful
https://www.youtube.com/watch?v=pJPOBKLYZYY
I want to use mod_disk_cache in apache to cache my xml feeds to a folder and serve direct from that folder.
These are feeds dynamically created by php - but not changing very often.
I want the caching at the htaccess level to avoid any strain/call to php and keep server stress to a minimum.
http://httpd.apache.org/docs/2.2/mod/mod_cache.html
httpd.apache.org/docs/2.2/mod/mod_disk_cache.html
Has anyone done this before? Did it work for you?
I'm getting my server company to install the modules I need and can then have a go myself.
I'm hoping to use something similar to:
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot c:/cacheroot
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
</IfModule>
</IfModule>
I'll be sending Expires: and Last-Modified: headers in the xml too.
Think this will give me the desired solution and filling that cache folder and avoiding calls to php?
Or is this approach all wrong?
Thanks in advance for any guidance
I used in the past Apache with mod_cache on a Unix environment. It worked fine with low user load, but days with heavy load the system went down all the day.
After some tests we moved to Varnish Cache and now everything works better.
The problem is that only Unix environment is supported, a new varnish windows cygwin-based version exists, but I don't now if is suitable for production environment:
http://varnish-cache.org/trac/wiki/VarnishOnCygwinWindows
It's not a bad thing. I've been using it long time ago. It works.
But you should know there are now really better alternatives when handling caches in front of an apache server. One of theses nice tools is Varnish. You will have very fine tunnings available.
Here's a deep explanation of why varnish is a modern tool and why this new way of using the OS (and not separating memory and disk in spirit) is good : http://www.varnish-cache.org/trac/wiki/ArchitectNotes
About the headers you should use theses headers to communicate with Varnish (or other things, like urls) and let the cache tool handle the final headers.
If you can have a direct access on your server and not just a restricted apache access try it. Now if you can only access apache configuration... but ... c:/cacheroot, you're using a windows server in production? You'll need an Unix-like system for varnish preferably 64bits.