515 pointsLike some sort of WPMU DEV God"
DirectoryDude
Member
—
5th July 2011 (10 months ago)
Planing on installing nginx need advice
My setup is
VPS Cloud 3 blocks of CPUs with 6 Gigs Ram
wp 3.1.3 Multi Site With Domain Mapping Plug in from wpmuDev
Dedicated IP other then servers IP (i hope i explained that correctly)
Do I need to do anything beside installing nginx the one I was going to use is the free on that has the whm control panel http://nginxcp.com/
I was just going to install it but thought about if there was any comparability problems with Multisite installs so I stopped and came here.
I came back to be a little more clearer on my setup
server has main domain
maindomain.com
server name is server.maindomain.com
then the main domain is a reseller with many web site under it
phpbb forums we will call it phpbbinstall1.com phpbbinstall2.com ect.
2 wp single installs we will call it wpinstall1.com wpinstall2.com
1 multisite install (The one I'm speaking about) with its own IP
we will call it multisiteinstall.com
the reason I'm mentioning this is I notice some people posting there nginx configs for wp installs and no one was clear on it you have multiple domains besides word press installs
I saw this so it confused me so when you are writing about how to setup be aware of the multiple domains
this is what I noticed server_name MYSITE.com;
would it be for me server_name server.maindomain.com;
I'm so confused (knocking head on table)
Planing on installing nginx need advice
My setup is
VPS Cloud 3 blocks of CPUs with 6 Gigs Ram
wp 3.1.3 Multi Site With Domain Mapping Plug in from wpmuDev
Dedicated IP other then servers IP (i hope i explained that correctly)
Do I need to do anything beside installing nginx the one I was going to use is the free on that has the whm control panel http://nginxcp.com/
I was just going to install it but thought about if there was any comparability problems with Multisite installs so I stopped and came here.
I came back to be a little more clearer on my setup
server has main domain
maindomain.com
server name is server.maindomain.com
then the main domain is a reseller with many web site under it
phpbb forums we will call it phpbbinstall1.com phpbbinstall2.com ect.
2 wp single installs we will call it wpinstall1.com wpinstall2.com
1 multisite install (The one I'm speaking about) with its own IP
we will call it multisiteinstall.com
the reason I'm mentioning this is I notice some people posting there nginx configs for wp installs and no one was clear on it you have multiple domains besides word press installs
I saw this so it confused me so when you are writing about how to setup be aware of the multiple domains
this is what I noticed server_name MYSITE.com;
would it be for me server_name server.maindomain.com;
I'm so confused (knocking head on table)
Thanks that helped some
If someone that has done this and can share a How -to / Config Files / ect. I would like to have it Configured as reverse proxy static file cache type of install ( i hope I said that Correctly)
in other words Apache will also be running
Let me say that I am no experienced server admin. It recently installed Nginx on a VPS (1GB Ram, 0.5 CPU) as my first setup and I followed some general recommendations from the forums here. They were
Debian
Apache mod_PHP
APC
Nginx and
Memcache
wildcard subdomains enabled
MySQL /phpMyAdmin
For a control panel I chose Webmin/Usermin over CPanel as WHM/cPanel was said to go heavy on ram and I did not need to manage user accounts. I guess your hardware specs allow for more tolerance in this regard.
For the NGINX install (from source) I learned as I went along and chose to follow the directives from this thread (jump over the first bit about Varnish):
I found the advantage in this over others that I don't need any integrator and caching plugins as all the caching is done server side. (In a first attempt with the integrator plugin I had some troubles getting Buddypress and W3TCache play together nicely - but probably more due to my lack of expertise and patience..).
It works well and stable for me now and the performace achieved is good enough for my purpose.with PageSpeed 95% Grade A and Yslow 91% Grade A (GTmetrix.com). with just a bit combining CSS and using the wp-minify plugin for JS. I have certainly not maxed out optimization. (there is a limit to my curiosity... :))
The config files I have assembled from bits and pieces and clues that I got from various sources and am not absolutely sure if they are 'foolproof', but they seem to work so far. Basically all front end stuff is cached and all back end (admin) stuff is not.
Nginx seems to be a bit of a moving target with functions added, modified and deprecated with every update. So let me just add my comments here as a general direction, without claim for anything in particular. There are certainly more experienced people around here when it comes to the config stuff.
Hope this helps you in some way. Just keep asking here and use Google for anything that pops up along the way - there is heaps of information out there. Good luck!
Thank you for that
The question that brings to mind now I see a lot of Debian / Ubuntu configs would centos5 configs be different?
The nginxcp people on their forum say just install and it should work out of the box. I guess that's for most normal web sites. we are talking about Hungry Hungry Wordpress now :>
I keep going for the keyboard to install then stop my self as I will probably regret it when wordpress is not working any more.
The other thing that bothers me is editing config files while in root I never did it. before this I had a system admin do it for my wifes Web hosting business and I had my personal sites on her server. Now that the web Hosting is no more I'm on my own and I'm forcing myself to learn this.
Now to find out how to edit files in root
:>
I guess Nginx will run out of the box, but as you assume rightly the question is the configuration requirements for your particular case. So it's certainly not a quick install, as it needs quite a bit of tweaking/configuring.
you might want to read this thread from the forum here to just get a bit an idea about the level of different opinions and options on the entire matter, plus some insight, why Debian/Ubuntu is preferred over CentOS:
I would not attempt to install in a live production environment without having a clear idea what you are doing... this is just my opinion. I fear it will be difficult to get it up and running without significant downtimes. And especially as you are hosting a bunch of sites with different requirements...
My advice would be to either either hire an expert or to move your sites to a server set up with Nginx.
Not that I want to talk you out of a learning experience - it's actually very valuable to get a grasp of it - but if you want to learn it, then I highly recommend you do so in a sandbox environment like on a small fresh server and gather some experience, before attempting to modify your production server ... (and don't forget to backup everything before attempting anything, so you can always easily fall back onto the present state).
Thank you Michel
I'm reading it now
Yes it is a production server and I would hire someone but I check one person out and I really don't want to pay $75 per WP install when I have 3 on the server.
If I can get someone that has the same type of setup I probably can get it running good.
the wordpress sites being down would not be a lose as the two don't make any money and the one thats my wife's is so new that no one knows its online again yet.(multisite)
then the forums phpbb would probably be no problem standard php sites the phpLD directory's would be no problem again standard php in in fact the tech on their support form recommended it.
Just have to find someone with the same type of setup as me
EDITED: I finished reading through it and a lot of good points were made I guess I will have to use mod_php and not suPHP but cPanel I like
mod_php was one of the questions I had in my mind so I will do that first. the other question I had was fastcgi how do I check if I have it and if not how to install it? and Do I need it?
honestly, this is server administration and if you need to ask such basic question as how do I check if I have X installed, you're in way over your head. Please don't take offense but you need to be aware you are now a server admin. You need to keep your system updated and make sure verything is running as intended. There is a reason why a certified server admin is earning big bucks. This is not a PC at your office you are playign with, its a publicly reachable server. You are responsible for it. IF it gets infected or hacked and is used in hacking or a DOS attack, you are responsible
That said, let me add some helpful info too:
- The link you gave in the beginning: Nginx Admin – cPanel nginx automated installer Plugin - that is only helpful if you run cPanel since its an add-on, do you have cPanel?
- Yes, things work differently in Centos than they do in Debian.
- you said:
server has main domain
maindomain.com
server name is server.maindomain.com
that is not quite possible. I am sure your server name is something like yxjajs.yourvpsprovider.com - it will definitely not have the name of one of your domains.
- As to your nginx config: for multisite you need a directive like this: server_name _; this is a catch all vhost which is needed for multisite with dub domain install and domain mapping if you want to use that.
- why are you looking to use nginx as a proxy for apache? why not use nginx and fastcgi and be done with it?
###edit###
read more of this thread, so here are some mroe points:
- you say you will be going with mod_Php - do you understand the difference between mod_Php and suPhp and fastCGI?
- I completely agree with Michel:
Not that I want to talk you out of a learning experience - it's actually very valuable to get a grasp of it - but if you want to learn it, then I highly recommend you do so in a sandbox environment like on a small fresh server and gather some experience, before attempting to modify your production server ... (and don't forget to backup everything before attempting anything, so you can always easily fall back onto the present state).
honestly, this is server administration and if you need to ask such basic question as how do I check if I have X installed, you're in way over your head. Please don't take offense but you need to be aware you are now a server admin. You need to keep your system updated and make sure verything is running as intended. There is a reason why a certified server admin is earning big bucks. This is not a PC at your office you are playign with, its a publicly reachable server. You are responsible for it. IF it gets infected or hacked and is used in hacking or a DOS attack, you are responsible
I do realize it and this is why I'm asking questions and getting feedback. when I wrote about how do I check I didn't realize fastcgi was a php handler.
stepping down from the witness stand now.
>only helpful if you run cPanel
Yes I'm using cpanel v11.30
>server_name _;
Noted thanks
>you say you will be going with mod_Php - do you understand the difference between mod_Php and
>suPhp and fastCGI?
Yes
@n2rga: glad you took my comment with humour.
so if you're using cPanel, go with that plugin. it seems reasonably good, at least from their sales pitch :-)
I still recommend not testing on the live server...
I think that is all I can contribute, speak up if you have more specific questions.
well, that cpanel plugin might come in handy: it says it allows you to switch your sites between apache and nginx. so well, switch back if it doesn't work ;-)
One thing I forgot to mention
My server name is the same name as my main domain or what in my mind was the main site
server.mydomainname.com
and one of the sites mydomainname.com is a wordpress site.
Should I change the server name and what will it effect if I do?
EDITED: according to cpanel It is important to choose a hostname that you will not be using for any account. You should choose something that will be socially acceptable, as it will appear in all mail headers. Your hostname must be a FQDN. In english, A hostname should consist of a name and a domain name. All valid hostnames should have 2 dots in them. Hostnames should never begin with "www". Hostnames should also not begin with a digit, nor end with a hyphen ("-").
So what that means to me in my mind was use a real domain name but not a name that you would use for an account like mysite.mydomainname.com
where mysite. is an account im not using
Should I use a domain name that I'm no using?
sever.extradomainimnotusing.com
I called my server mail.mydomainname.com because I installed postfix on it and am sending email from the server (which will eventually host all my domains) - made sense from a email / spam point of view (was recommended) to call it mail. / I don't see anything wrong with yours being called server, unless you want to call it something else?
I run Nginx (It's so much better than Apache) , you're going to love it ;)
The Domain part of it was brought up. It was questioned
that that is not quite possible. I am sure your server name is something like yxjajs.yourvpsprovider.com - it will definitely not have the name of one of your domains.
I'm on a Cloud VPS
edited: thanks I know I will. Lower cpu and fast sites is a wonderful thing :>
jepp, I brought that up. wasn't quite clear about it I admit.
the point is that as you quoted cPanel, you "usually" don't use a domain you want to actively use for anything else.
so if your VPS didn't come with a default name and domain (I've never encountered one that doesn't) you can certainly use a spare domain. I can't 100% explain this habit but look at it this way: by appointing a name/domain to your server you're basically tying it down to that server while domains, are usually something you can move from one server to another, change providers, etc.
basically you can use a spare domain, just make sure you don't need it for anything else.
as for the argument about postfix: since you'll be hosting multiple domains, it doesn't matter what name/domain you're giving your server since postfix will be handling multiple domains anyway...
just make sure you have your reverse DNS set up properly: http://en.wikipedia.org/wiki/Reverse_dns
I wasn't disagreeing with you ;) Just stating I have the same options available to me so there wasn't a concern about naming.
Yeah, with cloud hosting, in my case vps.net "they" offer you custom names -
they even list an e.g server1.domain.com when creating a new server - I presume due to the fact that you can have unlimited servers off of one account - things can get really confusing really fast - laugh.
Especially when you start offloading and creating multiple servers (msql, mail etc)
I agree 100% about the reverse dns - I did that already, had to request it via a support ticket (only thing you don't have control over at vps.net), took a day to do, but worth it and recommend the same to everyone ;)
Man i have been busy the last few days.
installed the free nginx with cPanel plugin Built in had a few errors posted about it on their forum got no answer searched the internet. Did not find one person talking about or saying they used it let alone how to fix the error.
Found answer on one error, then they finally posted about it on their forum and said I should search the forum it was discussed many times. Then I spoke up about it and every question after that was ignored.In fact they still have not answered one of my questions. My advice they have a lot of posts having to do with nginx config they they don't answer and let it go. only ones they address is their plugin for cpanel. Uninstalled. Went to the paid version of nginx ($5 a month one) installed everything looked great asked in forum about rewrites and were told to put them into a fold that would include the domain rules I was very confused got no answer in their forum, put in a support ticket was answered basically said to add them to an include file and put it into a include folder. Wrote them back and if they can help me with the rewrite rules. they said that they would not answer because its I had custom work. I said its not custom it rewrite rules then they gave me 3 lines and turned out that one line server _; you can't include it that file found that out after looking at the error log. They wouldn't help with rewrites I guess same thing they concentrate on their plug in not Nginx.
Uninstalled started looking for a Nginx guru. said to my self This is not kicking my you know what. so I I installed the regular Nginx from Nginx.com, Works great. But I do need to get the rewrite rules for Wordpress so I'm now looking here for a set that I can use for my situation My next post under this I will post what I have so far. I would apreciate anyone that can help me with them and look at my config. and tell me if what I have is good.
Bear in mind I have no idea what I'm doing LoL. No really I don't :>
Here is my setup
Cloud VPS with 6 Gigs ram 3 CPU's (Blocks) 80 gigs space
Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 TimmiT HTTPD Server powered by Apache mod_fcgid/2.3.6
php 5
The list of sites are http://www.thejokeforum.com - phpBB http://www.sampsonforum.com - phpBB http://www.stargatestyles.com - phpBB
user nobody;
# no need for more workers in the proxy mode
worker_processes 1;
error_log logs/error.log info;
worker_rlimit_nofile 8192;
events {
worker_connections 512; # you might need to increase this setting for busy servers
use epoll; # Linux kernels 2.4.x change to rtsig
}
http {
server_names_hash_max_size 2048;
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
include "/usr/local/nginx/conf/vhost.conf";
}
The vhost.conf is one file.
Can I separate the domains with for example one file for each doamin
domain.com
domain1.com
domain2.com
domain3.com
Make a directory and put them all in like the example on codex.wordpress? include sites-enabled/*;
Is there anything else I would need to do to achieve this?
vhost.conf
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name 3aliens.net http://www.3aliens.net;
# The line above is a add on Domain (Mapped) to n2rga.bloginsphere.com
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/aliens/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.3aliens.net:81http://www.3aliens.net;
proxy_redirect http://3aliens.net:81http://3aliens.net;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
# deny access to .htaccess files.
#
location ~ /\.ht {
deny all;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name 3aliens.org http://www.3aliens.org;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/aliensor/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.3aliens.org:81http://www.3aliens.org;
proxy_redirect http://3aliens.org:81http://3aliens.org;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name arcadedirectory.net http://www.arcadedirectory.net;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/arcadedi/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.arcadedirectory.net:81http://www.arcadedirectory.net;
proxy_redirect http://arcadedirectory.net:81http://arcadedirectory.net;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name .bloginsphere.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/bloginsp/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.bloginsphere.com:81http://www.bloginsphere.com;
proxy_redirect http://bloginsphere.com:81http://bloginsphere.com;
proxy_pass http://216.120.248.206:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name n2rga.com http://www.n2rga.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/bloginsp/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.n2rga.com:81http://www.n2rga.com;
proxy_redirect http://n2rga.com:81http://n2rga.com;
proxy_pass http://216.120.248.206:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name hamradiostop.com http://www.hamradiostop.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/hamradio/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.hamradiostop.com:81http://www.hamradiostop.com;
proxy_redirect http://hamradiostop.com:81http://hamradiostop.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name hamrepeaterdirectory.com http://www.hamrepeaterdirectory.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/hamrepea/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.hamrepeaterdirectory.com:81http://www.hamrepeaterdirectory.com;
proxy_redirect http://hamrepeaterdirectory.com:81http://hamrepeaterdirectory.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name phpbbdirectory.net http://www.phpbbdirectory.net;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/phpbbdir/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.phpbbdirectory.net:81http://www.phpbbdirectory.net;
proxy_redirect http://phpbbdirectory.net:81http://phpbbdirectory.net;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name phpbbmodinstalls.com http://www.phpbbmodinstalls.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/phpbbmod/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.phpbbmodinstalls.com:81http://www.phpbbmodinstalls.com;
proxy_redirect http://phpbbmodinstalls.com:81http://phpbbmodinstalls.com;
proxy_pass http://216.120.248.226:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name nli.phpbbmodinstalls.com http://www.nli.phpbbmodinstalls.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/phpbbmod/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.nli.phpbbmodinstalls.com:81http://www.nli.phpbbmodinstalls.com;
proxy_redirect http://nli.phpbbmodinstalls.com:81http://nli.phpbbmodinstalls.com;
proxy_pass http://216.120.248.226:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name nli.arrl.org http://www.nli.arrl.org;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/phpbbmod/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.nli.arrl.org:81http://www.nli.arrl.org;
proxy_redirect http://nli.arrl.org:81http://nli.arrl.org;
proxy_pass http://216.120.248.226:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name sampsonforum.com http://www.sampsonforum.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/sampsonf/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.sampsonforum.com:81http://www.sampsonforum.com;
proxy_redirect http://sampsonforum.com:81http://sampsonforum.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name stargatestyles.com http://www.stargatestyles.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/sgstyles/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.stargatestyles.com:81http://www.stargatestyles.com;
proxy_redirect http://stargatestyles.com:81http://stargatestyles.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name stargateportal.info http://www.stargateportal.info;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/stargate/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.stargateportal.info:81http://www.stargateportal.info;
proxy_redirect http://stargateportal.info:81http://stargateportal.info;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name thearcadestation.com http://www.thearcadestation.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/thearcad/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.thearcadestation.com:81http://www.thearcadestation.com;
proxy_redirect http://thearcadestation.com:81http://thearcadestation.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name thejokeforum.com http://www.thejokeforum.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/thejokef/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.thejokeforum.com:81http://www.thejokeforum.com;
proxy_redirect http://thejokeforum.com:81http://thejokeforum.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name urllistingdirectory.com http://www.urllistingdirectory.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/urllisti/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.urllistingdirectory.com:81http://www.urllistingdirectory.com;
proxy_redirect http://urllistingdirectory.com:81http://urllistingdirectory.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name viralvideopalace.com http://www.viralvideopalace.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/viralvid/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.viralvideopalace.com:81http://www.viralvideopalace.com;
proxy_redirect http://viralvideopalace.com:81http://viralvideopalace.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
access_log off;
error_log logs/vhost-error_log warn;
listen 80;
server_name websitelistingdirectory.com http://www.websitelistingdirectory.com;
# uncomment location below to make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
root /home/websitel/public_html;
}
location / {
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
# you can increase proxy_buffers here to suppress "an upstream response
# is buffered to a temporary file" warning
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_redirect http://www.websitelistingdirectory.com:81http://www.websitelistingdirectory.com;
proxy_redirect http://websitelistingdirectory.com:81http://websitelistingdirectory.com;
proxy_pass http://216.120.248.225:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
there is a free cpanel plugin you mentioned and then I heard there is a paid cpanel plugin out there as well. nginx is still free! you might be paying for a plugin to integrate with cpanel, but nginx is free.
no to your vhost:
are you wanting to use nginx exclusively now? not as a proxy in front of apache anymore?
I suggest you split your configs into one file for each vhost but basically all you need for wordpress basic rewrites is line 5-7
this is one of my vhosts:
server {
server_name _yourdomain.tld;
root /var/www/yourdomain.tld;
include /etc/nginx/php.conf;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# use fastcgi for all php files
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# catch all
error_page 404 /index.php;
# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}
}
Yes nginx is free. I do understand that I didn't say it was paid for. the pay version is for the free nginx and cpanel add on.
I would like to run nginx as a proxy in front of Apache.
When I split them up to seprate files I do it the way I mentions with the line I mentioned like this
domain.com
domain1.com
domain2.com
domain3.com
Make a directory and put them all in like the example on codex.wordpress?
include sites-enabled/*;
I searched Google and Ubuntu uses sites-enabled / sites-disabled by default
So to explain the above correctly If I have an include directory all the vhosts files would load from that directory.
so I would put in the nginx.conf file include mysites/*;
This is the template for the startup config file nginx.conf
I removed the vhosts include at the end and added a include to load everything in the mysites directory. That is if it works that way?
user nobody;
# no need for more workers in the proxy mode
worker_processes 1;
error_log logs/error.log info;
worker_rlimit_nofile 8192;
events {
worker_connections 512; # you might need to increase this setting for busy servers
use epoll; # Linux kernels 2.4.x change to rtsig
}
http {
server_names_hash_max_size 2048;
index index.html index.htm index.php;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
# include "/usr/local/nginx/conf/vhost.conf";
include mysites/*;
}
I'm getting a 502 Bad Gateway with the load of all the files in a directory so I switched all the domain into one vhosts same problem so its not the loading of all the vhost files there one now.
I will probably start a new thread in and hour or two if I can't find it.
unless some one can help going top post my current files nginx -t says configuration is good.
here's the nginx.conf
user nobody;
# no need for more workers in the proxy mode
worker_processes 1;
error_log logs/error.log info;
worker_rlimit_nofile 8192;
events {
worker_connections 512; # you might need to increase this setting for busy servers
use epoll; # Linux kernels 2.4.x change to rtsig
}
http {
server_names_hash_max_size 2048;
index index.html index.htm index.php;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
include "/usr/local/nginx/conf/vhost.conf";
# include /usr/local/nginx/mysites/*;
}
Responses (25)
Member — 5th July 2011 (10 months ago) #
Just searched Google and found this.
Should I do it this way or is there another better way.
http://contra.net.au/2010/10/12/create-a-network-wordpress-3-nginx/
the site is all setup. I would just need to follow the nginx settings?
EDITED above after posting this.
This really confused me after reading some more.
anyone have a How to?
Sales & Support Pro — 5th July 2011 (10 months ago) #
Hiya!
I'm afraid I don't have any experience with Nginx so can't offer specific advice but hopefully others will...
I did have a quick browse around to see what I could find and came up with these you might want to check out:
http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/
http://codex.wordpress.org/Nginx
http://wordpress.org/extend/plugins/nginx-compatibility/
Hope that helps!
Phil
Member — 5th July 2011 (10 months ago) #
Thanks that helped some
If someone that has done this and can share a How -to / Config Files / ect. I would like to have it Configured as reverse proxy static file cache type of install ( i hope I said that Correctly)
in other words Apache will also be running
Member — 5th July 2011 (10 months ago) #
Hi n2rga
Let me say that I am no experienced server admin. It recently installed Nginx on a VPS (1GB Ram, 0.5 CPU) as my first setup and I followed some general recommendations from the forums here. They were
Debian
Apache mod_PHP
APC
Nginx and
Memcache
wildcard subdomains enabled
MySQL /phpMyAdmin
For a control panel I chose Webmin/Usermin over CPanel as WHM/cPanel was said to go heavy on ram and I did not need to manage user accounts. I guess your hardware specs allow for more tolerance in this regard.
For the NGINX install (from source) I learned as I went along and chose to follow the directives from this thread (jump over the first bit about Varnish):
http://www.myatus.co.uk/2010/06/28/a-simplified-nginx-apache-combo-with-wordpress-support/
I found the advantage in this over others that I don't need any integrator and caching plugins as all the caching is done server side. (In a first attempt with the integrator plugin I had some troubles getting Buddypress and W3TCache play together nicely - but probably more due to my lack of expertise and patience..).
It works well and stable for me now and the performace achieved is good enough for my purpose.with PageSpeed 95% Grade A and Yslow 91% Grade A (GTmetrix.com). with just a bit combining CSS and using the wp-minify plugin for JS. I have certainly not maxed out optimization. (there is a limit to my curiosity... :))
The config files I have assembled from bits and pieces and clues that I got from various sources and am not absolutely sure if they are 'foolproof', but they seem to work so far. Basically all front end stuff is cached and all back end (admin) stuff is not.
Nginx seems to be a bit of a moving target with functions added, modified and deprecated with every update. So let me just add my comments here as a general direction, without claim for anything in particular. There are certainly more experienced people around here when it comes to the config stuff.
Hope this helps you in some way. Just keep asking here and use Google for anything that pops up along the way - there is heaps of information out there. Good luck!
Michel
Member — 5th July 2011 (10 months ago) #
Thank you for that
The question that brings to mind now I see a lot of Debian / Ubuntu configs would centos5 configs be different?
The nginxcp people on their forum say just install and it should work out of the box. I guess that's for most normal web sites. we are talking about Hungry Hungry Wordpress now :>
I keep going for the keyboard to install then stop my self as I will probably regret it when wordpress is not working any more.
The other thing that bothers me is editing config files while in root I never did it. before this I had a system admin do it for my wifes Web hosting business and I had my personal sites on her server. Now that the web Hosting is no more I'm on my own and I'm forcing myself to learn this.
Now to find out how to edit files in root
:>
Member — 6th July 2011 (10 months ago) #
I guess Nginx will run out of the box, but as you assume rightly the question is the configuration requirements for your particular case. So it's certainly not a quick install, as it needs quite a bit of tweaking/configuring.
you might want to read this thread from the forum here to just get a bit an idea about the level of different opinions and options on the entire matter, plus some insight, why Debian/Ubuntu is preferred over CentOS:
http://premium.wpmudev.org/forums/topic/yet-another-server-thred
I would not attempt to install in a live production environment without having a clear idea what you are doing... this is just my opinion. I fear it will be difficult to get it up and running without significant downtimes. And especially as you are hosting a bunch of sites with different requirements...
My advice would be to either either hire an expert or to move your sites to a server set up with Nginx.
Not that I want to talk you out of a learning experience - it's actually very valuable to get a grasp of it - but if you want to learn it, then I highly recommend you do so in a sandbox environment like on a small fresh server and gather some experience, before attempting to modify your production server ... (and don't forget to backup everything before attempting anything, so you can always easily fall back onto the present state).
Member — 6th July 2011 (10 months ago) #
Thank you Michel
I'm reading it now
Yes it is a production server and I would hire someone but I check one person out and I really don't want to pay $75 per WP install when I have 3 on the server.
If I can get someone that has the same type of setup I probably can get it running good.
the wordpress sites being down would not be a lose as the two don't make any money and the one thats my wife's is so new that no one knows its online again yet.(multisite)
then the forums phpbb would probably be no problem standard php sites the phpLD directory's would be no problem again standard php in in fact the tech on their support form recommended it.
Just have to find someone with the same type of setup as me
EDITED: I finished reading through it and a lot of good points were made I guess I will have to use mod_php and not suPHP but cPanel I like
mod_php was one of the questions I had in my mind so I will do that first. the other question I had was fastcgi how do I check if I have it and if not how to install it? and Do I need it?
Member — 6th July 2011 (10 months ago) #
@n2rga:
honestly, this is server administration and if you need to ask such basic question as how do I check if I have X installed, you're in way over your head. Please don't take offense but you need to be aware you are now a server admin. You need to keep your system updated and make sure verything is running as intended. There is a reason why a certified server admin is earning big bucks. This is not a PC at your office you are playign with, its a publicly reachable server. You are responsible for it. IF it gets infected or hacked and is used in hacking or a DOS attack, you are responsible
That said, let me add some helpful info too:
- The link you gave in the beginning: Nginx Admin – cPanel nginx automated installer Plugin - that is only helpful if you run cPanel since its an add-on, do you have cPanel?
- Yes, things work differently in Centos than they do in Debian.
- you said:
that is not quite possible. I am sure your server name is something like yxjajs.yourvpsprovider.com - it will definitely not have the name of one of your domains.
- As to your nginx config: for multisite you need a directive like this:
server_name _;this is a catch all vhost which is needed for multisite with dub domain install and domain mapping if you want to use that.- Any info you need about nginx can be found here: http://wiki.nginx.org
- why are you looking to use nginx as a proxy for apache? why not use nginx and fastcgi and be done with it?
###edit###
read more of this thread, so here are some mroe points:
- you say you will be going with mod_Php - do you understand the difference between mod_Php and suPhp and fastCGI?
- I completely agree with Michel:
Member — 6th July 2011 (10 months ago) #
@Ovidiu
thanks every little bit helps
honestly, this is server administration and if you need to ask such basic question as how do I check if I have X installed, you're in way over your head. Please don't take offense but you need to be aware you are now a server admin. You need to keep your system updated and make sure verything is running as intended. There is a reason why a certified server admin is earning big bucks. This is not a PC at your office you are playign with, its a publicly reachable server. You are responsible for it. IF it gets infected or hacked and is used in hacking or a DOS attack, you are responsible
I do realize it and this is why I'm asking questions and getting feedback. when I wrote about how do I check I didn't realize fastcgi was a php handler.
stepping down from the witness stand now.
>only helpful if you run cPanel
Yes I'm using cpanel v11.30
>server_name _;
Noted thanks
>you say you will be going with mod_Php - do you understand the difference between mod_Php and
>suPhp and fastCGI?
Yes
Member — 6th July 2011 (10 months ago) #
@n2rga: glad you took my comment with humour.
so if you're using cPanel, go with that plugin. it seems reasonably good, at least from their sales pitch :-)
I still recommend not testing on the live server...
I think that is all I can contribute, speak up if you have more specific questions.
###edit###
in case you are looking for a quick and easy solution for working with small VPS, I have successfully tested this solution: https://github.com/Xeoncross/lowendscript but beware of these issues: https://github.com/lowendbox/lowendscript/issues?sort=updated&direction=desc&state=open
Member — 6th July 2011 (10 months ago) #
I look at it this way if it doesn't work out I will uninstall it.
Thanks for the pointers.
Member — 6th July 2011 (10 months ago) #
well, that cpanel plugin might come in handy: it says it allows you to switch your sites between apache and nginx. so well, switch back if it doesn't work ;-)
Member — 6th July 2011 (10 months ago) #
One thing I forgot to mention
My server name is the same name as my main domain or what in my mind was the main site
server.mydomainname.com
and one of the sites mydomainname.com is a wordpress site.
Should I change the server name and what will it effect if I do?
EDITED: according to cpanel
It is important to choose a hostname that you will not be using for any account. You should choose something that will be socially acceptable, as it will appear in all mail headers. Your hostname must be a FQDN. In english, A hostname should consist of a name and a domain name. All valid hostnames should have 2 dots in them. Hostnames should never begin with "www". Hostnames should also not begin with a digit, nor end with a hyphen ("-").
So what that means to me in my mind was use a real domain name but not a name that you would use for an account like mysite.mydomainname.com
where mysite. is an account im not using
Should I use a domain name that I'm no using?
sever.extradomainimnotusing.com
Lifetime Member — 6th July 2011 (10 months ago) #
I called my server mail.mydomainname.com because I installed postfix on it and am sending email from the server (which will eventually host all my domains) - made sense from a email / spam point of view (was recommended) to call it mail. / I don't see anything wrong with yours being called server, unless you want to call it something else?
I run Nginx (It's so much better than Apache) , you're going to love it ;)
Jonathan.
Member — 6th July 2011 (10 months ago) #
The Domain part of it was brought up. It was questioned
that
that is not quite possible. I am sure your server name is something like yxjajs.yourvpsprovider.com - it will definitely not have the name of one of your domains.I'm on a Cloud VPS
edited: thanks I know I will. Lower cpu and fast sites is a wonderful thing :>
Member — 6th July 2011 (10 months ago) #
jepp, I brought that up. wasn't quite clear about it I admit.
the point is that as you quoted cPanel, you "usually" don't use a domain you want to actively use for anything else.
so if your VPS didn't come with a default name and domain (I've never encountered one that doesn't) you can certainly use a spare domain. I can't 100% explain this habit but look at it this way: by appointing a name/domain to your server you're basically tying it down to that server while domains, are usually something you can move from one server to another, change providers, etc.
basically you can use a spare domain, just make sure you don't need it for anything else.
as for the argument about postfix: since you'll be hosting multiple domains, it doesn't matter what name/domain you're giving your server since postfix will be handling multiple domains anyway...
just make sure you have your reverse DNS set up properly: http://en.wikipedia.org/wiki/Reverse_dns
Lifetime Member — 7th July 2011 (10 months ago) #
@Ovidiu,
I wasn't disagreeing with you ;) Just stating I have the same options available to me so there wasn't a concern about naming.
Yeah, with cloud hosting, in my case vps.net "they" offer you custom names -
they even list an e.g server1.domain.com when creating a new server - I presume due to the fact that you can have unlimited servers off of one account - things can get really confusing really fast - laugh.
Especially when you start offloading and creating multiple servers (msql, mail etc)
I agree 100% about the reverse dns - I did that already, had to request it via a support ticket (only thing you don't have control over at vps.net), took a day to do, but worth it and recommend the same to everyone ;)
Jonathan
Member — 11th July 2011 (10 months ago) #
Man i have been busy the last few days.
installed the free nginx with cPanel plugin Built in had a few errors posted about it on their forum got no answer searched the internet. Did not find one person talking about or saying they used it let alone how to fix the error.
Found answer on one error, then they finally posted about it on their forum and said I should search the forum it was discussed many times. Then I spoke up about it and every question after that was ignored.In fact they still have not answered one of my questions. My advice they have a lot of posts having to do with nginx config they they don't answer and let it go. only ones they address is their plugin for cpanel. Uninstalled. Went to the paid version of nginx ($5 a month one) installed everything looked great asked in forum about rewrites and were told to put them into a fold that would include the domain rules I was very confused got no answer in their forum, put in a support ticket was answered basically said to add them to an include file and put it into a include folder. Wrote them back and if they can help me with the rewrite rules. they said that they would not answer because its I had custom work. I said its not custom it rewrite rules then they gave me 3 lines and turned out that one line server _; you can't include it that file found that out after looking at the error log. They wouldn't help with rewrites I guess same thing they concentrate on their plug in not Nginx.
Uninstalled started looking for a Nginx guru. said to my self This is not kicking my you know what. so I I installed the regular Nginx from Nginx.com, Works great. But I do need to get the rewrite rules for Wordpress so I'm now looking here for a set that I can use for my situation My next post under this I will post what I have so far. I would apreciate anyone that can help me with them and look at my config. and tell me if what I have is good.
Bear in mind I have no idea what I'm doing LoL. No really I don't :>
Member — 11th July 2011 (10 months ago) #
Here is my setup
Cloud VPS with 6 Gigs ram 3 CPU's (Blocks) 80 gigs space
Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 TimmiT HTTPD Server powered by Apache mod_fcgid/2.3.6
php 5
The list of sites are
http://www.thejokeforum.com - phpBB
http://www.sampsonforum.com - phpBB
http://www.stargatestyles.com - phpBB
http://bloginsphere.com - Wordpress 3.2 Multi Site - New no users yet - WP-Super Cache plugin installed
http://www.thearcadestation.com - Wordpress 3.2 Single Site
http://www.stargateportal.info - Wordpress 3.2 Single Site
http://www.phpbbmodinstalls.com - Wordpress 3.2 Single Site
http://nli.arrl.org - Wordpress 3.2 Single Site this is a sub domain nli.phpbbmodinstalls.com and arrl.org is pointing a subdomain to it for nli.arrl.org result
http://www.urllistingdirectory.com - phpLD Link Directory
http://www.websitelistingdirectory.com - phpLD Link Directory
http://www.arcadedirectory.net - phpLD Link Directory
http://www.phpbbdirectory.net - phpLD Link Directory
http://www.hamradiostop.com - phpLD Link Directory
http://www.viralvideopalace.com/ - phpLD Video Directory
http://www.3aliens.net- has a wordpress site but its a test site
http://www.3aliens.org has the same site as bloginsphere for test and backup (JUSTIN CASE) :>
nginx.conf
The vhost.conf is one file.
Can I separate the domains with for example one file for each doamin
domain.com
domain1.com
domain2.com
domain3.com
Make a directory and put them all in like the example on codex.wordpress?
include sites-enabled/*;Is there anything else I would need to do to achieve this?
vhost.conf
fastcgi.conf
fastcgi_params
Member — 11th July 2011 (10 months ago) #
firts of all, lets clarify a few things:
nginx is a free script.
there is a free cpanel plugin you mentioned and then I heard there is a paid cpanel plugin out there as well. nginx is still free! you might be paying for a plugin to integrate with cpanel, but nginx is free.
no to your vhost:
are you wanting to use nginx exclusively now? not as a proxy in front of apache anymore?
I suggest you split your configs into one file for each vhost but basically all you need for wordpress basic rewrites is line 5-7
this is one of my vhosts:
###edit###
did I mention nginx is free?
Member — 11th July 2011 (10 months ago) #
Yes nginx is free. I do understand that I didn't say it was paid for. the pay version is for the free nginx and cpanel add on.
I would like to run nginx as a proxy in front of Apache.
When I split them up to seprate files I do it the way I mentions with the line I mentioned like this
domain.com
domain1.com
domain2.com
domain3.com
Make a directory and put them all in like the example on codex.wordpress?
include sites-enabled/*;
Thanks for the help
Member — 11th July 2011 (10 months ago) #
I searched Google and Ubuntu uses sites-enabled / sites-disabled by default
So to explain the above correctly If I have an include directory all the vhosts files would load from that directory.
so I would put in the nginx.conf file
include mysites/*;Member — 11th July 2011 (10 months ago) #
This is the template for the startup config file nginx.conf
I removed the vhosts include at the end and added a include to load everything in the mysites directory. That is if it works that way?
This is the template for a non Wordpress Site
Working on the wordpress one now
Member — 12th July 2011 (10 months ago) #
I'm getting a 502 Bad Gateway with the load of all the files in a directory so I switched all the domain into one vhosts same problem so its not the loading of all the vhost files there one now.
I will probably start a new thread in and hour or two if I can't find it.
unless some one can help going top post my current files nginx -t says configuration is good.
here's the nginx.conf
heres the vhost file
I used the old vhosts with the new nginx.cof file and server back up
Does anyone see a problem why I'm getting a 502 Bad Gateway error?
Member — 12th July 2011 (10 months ago) #
Posted problem here:
http://premium.wpmudev.org/forums/topic/nginx-502-bad-gateway?replies=1#post-112177
Become a member