Nginx As Apache Proxy For Static Content -- Configuration
Nov 23, 2007
I am a non-tech person trying to configure Nginx to serve static content (apache will remain on port 80 for the dynamic stuff).
Nginx is already installed, what I need is a workable configuration file for nginx so that it serves all static stuff (images and a few folders with static html) and instructions in how to create it. The server is running DirectAdmin panel, Apache 2.24, PHP 5.23 and XCache 1.2.
I'm looking for a way to get a little more mileage out of Apache + PHP environment without losing Apache capabilities. In shared hosting environments, losing features such as .htaccess and a real mod_rewrite are not even on the table. I'm also not willing to accept the performance hit and connection issues that are inherent with FastCGI, so that means mod_php.
In this particular situation, there are two busy sites, which are the problem.
These are a few ideas I've been thinking about.
1. mod_proxy + nginx: mod_proxy sends static content requests to nginx. This requires two sets of vhost files to be maintained.
2. mod_cache: Caching common static content such as page graphics .css, .js, etc.
3. squid
If you've been down 2 or more of these roads, I could benefit from your experience.
I am using a Windows 7 and the proxy server is working fine. However, I need to run a web content filtering on the server. This should be able to replace or change specific words or phrases from an incoming html and deliver it to the client. I have searched the internet for days for a working configuration but none of them worked. Here is the current configuration I added on the httpd.conf file:
TEST 1: Without <FilesMatch> directive, the headers are set to all requested content as it should. This includes content served from apache server and content from a separate application server.
TEST 2: If I use the above configuration example, I can see that static content comes with correct headers only
I'm configuring an VPS that's going to serve all static stuff and absolutely no dynamic scripts at all.
What could be the bottle necks with all these static content websites? Can a 256MB VPS handle a static website receiving millions of page views a month?
I'm trying to serve as much gzipped content as possible on my web site. I will gzip dynamic pages on the fly using PHP, and I plan to gzip static content just one time, not to use much CPU, and serve css.gz, .js.gz files, etc... So, I uploaded a test.html file and a .css file that changes the color of the text to red. I gzipped the css file:
%gzip style.css
I also uploaded an .htaccess file with this content:
RewriteEngine on RewriteBase /gzip/ RewriteCond %{HTTP_ACCEPT_ENCODING} gzip RewriteRule ^(([^.]+.)+)css$ /$1css.gz
For now I'm not going to include any gunzipped style sheet, just to make sure my browser picks the gzipped style sheet. I also uploaded a phpinfo.php file to make sure I have mod_gzip. So, here's the list of files I have:
But when I open the test.html file: [url] the style sheet isn't applied. If I upload a regular style.css file, it works fine. It seems the Rewrite rules aren't taken into account. Do you know how I could server the gzipped style sheet instead?
This config is working fine until we try to load resources from the alias over ssl, I believe something is missing in the Nginx config. I'm not getting any info using the logs.
I've got a dedicated server running my portal. Now we plan to soon launch broadcasting, where we via a webcam + microphone will broadcast (streaming WMV media) to all our members. Our members will then be able to interact with the speakers via chatting.
Now we are currently undergoing loadtesting, with our current setup, which is:
2. home PC with static IP and 1 MBit upload=>Video+Audio Streaming
So the member requests a page from the dedicated server, which has a chat window and a windows media player. The player will retrieve the video/audio content from the home PC. This is done by the client.
Now is pretty logical to see that there will be limitations in how many connections the home pc will be able to handle.
The question is: How do i make the dedicated server get the content from the home pc (so it only serves one connection) and then get all the clients to get their video content from the dedicated server ?
I've looked into the proxy modules for the apache server, however they (forward/reverse proxy) both passes the connection on to the remote machine and thereby not doing what I want to do.
Centos6.6 x86_64 Minimal install + Plesk12 installation completed without problem.
However when I logged into Plesk Panel i get this message.
ERROR: PleskException Up Level Unable to configure control panel: nginxmng failed: [2014-12-02 07:32:44] ERR [util_exec] proc_close() failed enabling nginx proxy failed: 255 Service /etc/init.d/httpd failed to start Service /etc/init.d/httpd failed to start
Nginx proxy changes had been reverted.
Everything seems to work but i would like to have it enabled for performance reasons, when i check it # /etc/init.d/nginx status nginx is stopped
Then I try to start it manually /etc/init.d/nginx start Not starting nginx as it is disabled in config
then i try to force it /usr/local/psa/admin/bin/nginxmng --enable
[2014-12-02 08:19:48] ERR [util_exec] proc_close() failed enabling nginx proxy failed: 255 Service /etc/init.d/httpd failed to start Service /etc/init.d/httpd failed to start Nginx proxy changes had been reverted.
With enabled nginx I'm unable to contact web pages via TLSv1.1 and TLSv1.2. When nginx is disabled and the pages are handled by Apache everything is fine. But only when nginx is completely deactivated. It's not enough to disable "Smart static files processing" at the "Web Server Settings for sub.domain.tld".
I tried to add "ssl_protocols TLSv1.1 TLSv1.2;" at "Additional nginx directives" at the Web Server Settings, without effect.
I think i have to modify /etc/nginx/plesk.conf.d/server.conf but this file is generated by Plesk.
Trying to enable CORS (cross-origin resource sharing)? I've tried just about everything with the NGINX conf files and individual conf files, but nothing seems to be working...
For some reason my nginx doenst start and I get the following error:
Error: Unable to start service: Unable to manage service by nginxmng: [2015-05-30 01:03:20] ERR [util_exec] proc_close() failed enabling nginx proxy failed: getsebool: SELinux is disabled
255 Service /etc/init.d/nginx failed to start getsebool: SELinux is disabled
i successfully installed Squid Proxy on my other Dedicated server however that dedicated server had 50 ip address, i am wondering if i can use those ip address for my Squid Proxy?
I transferred my WordPress site to static HTML website, but some other website have a link to my old WordPress site URL....
I want to redirect all traffic from that URL to new URL which is URL...., but my redirect in .htaccess file doesn't work (Redirect 301 /?page_id=1234 URL... because of the query string."mod_rewrite" to create the right code in .htaccess file.
I'm using the isapi rewrite module for iis 6 which uses the exact same syntax as mod_rewrite in apache. I'm not very well versed in apache and need getting this to work asap. Basically I have a directory in our website: URL....
I need to forward this to an IP address, for example to this address:100.12.33.45/folder.While keeping the original URL (www.xyz.edu/folder). I'm unsure of the apache syntax for this.
I am wondering if there is an easy way to convert apache to nginx on my Plesk 12 server. Ideally, I would like to save all my hosts without having to re set them all up. I have been searching online, but haven't found a simple way to do so.
According to the latest trend and technological advances, which server software should people go with from the very beginning. Which do you recommend as on today?
btw anybody has experience with all 3 (apache/nginx/litespeed) webservers?
I have -
On a common shared environment, I started off with Apache - was fine until some load started generating and it became crapache.
Then litespeed - Totally awesome, could seriously feel the difference, but its cost is something not everybody can afford.
Then nginx - Very nice, felt like litespeed only, the only difference was it got quite complex in configuring it at a later stage BUT its free'ness made me love it badly.
I have a VPS running Parallels Plesk 12.0.18 Update#36 and CentOS 6.6. I'll like to move (if it's possible uninstall complete) Apache and let Nginx to manage all the request coming from outside.
Whatever i try to modify configuration there is no way i can get file delivered by apache or NGINX to be deflate/gzip compressed.
OS: Debian 7.7 Plesk version: 12.0.18 Update #33
I've tried to add these lines to Nginx (Vhost directives) but it change nothing : # Gzip Settings gzip on; gzip_buffers 16 8k; gzip_comp_level 4; gzip_http_version 1.1; gzip_min_length 1100; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/x-javascr$ application/xml application/xhtml+xml application/xml+rss; gzip_vary on; gzip_static on; gzip_proxied any; gzip_disable "MSIE [1-6].";
I also tried to disable Nginx and configure deflate in apache with following lines (Vhost directives then in a file in apache2/conf.d) but it is the same ...