Wondering how to set Nginx Catch-All Host For ISPConfig 3? We can help you.
As part of our Server Management Services, we assist our customers with several Nginx queries.
Today, let us see how our support techs perform the same.
Nginx Catch-All Host For ISPConfig 3
In order to begin, our Support Techs recommend a fully functional Apache/Mysql server (s).
In addition, we need Ubuntu 12.04 LTS / 13.x or Debian 6/7 server and functional installation of Isp Config 3.
-
INSTALL AND CONFIGURE
First of all, the configuration is done on the principle of Catch All VHost. It encompasses all the sites in a single configuration.
The first thing we need to do here is to stop the apache service.
apache2 stop service
Then we will modify the ports in the apache configuration:
nano /etc/apache2/ports.conf NameVirtualHost *: 82
After that, we will modify all the virtualhosts that listen on port 80:
sed -ie ‘s / *: 80 / *: 82 / g’ /etc/apache2/sites-available/*.vhost
Eventually, we relaunch apache:
service apache2 start
Now, we need to test if the configuration is Ok. Normally, the port 80 should not appear:
netstat -tunap | grep apache2 tcp6 0 0 ::: 8080 ::: * LISTEN 3259 / apache2 tcp6 0 0 ::: 8081 ::: * LISTEN 3259 / apache2 tcp6 0 0 ::: 82 ::: * LISTEN 3259 / apache2 tcp6 0 0 ::: 443 ::: * LISTEN 3259 / apache2
Later, we modify the default templates of Isp Config for Apache.
To do so, first we will copy them to the custom conf folder:
cd / usr / local / ispconfig / server / cp conf / apache_ispconfig.conf.master conf-custom / cp conf / vhost.conf.master conf-custom /
Then we edit this file to replace port 80 with port 82:
nano /usr/local/ispconfig/server/conf-custom/apache_ispconfig.conf.master —-> (variable “NameVirtualHost *:” at line 123)
This might lead to a problem because for the statistics tools, among other things … ALL the requests will come from address 127.0.0.1.
To solve this, we will install the rpaf mod:
apt-get install libapache2-mod-rpaf
Then we edit the apache configuration
nano /etc/apache2/apache2.conf
In addition, we add this at the end:
RPAFsethostname On RPAFproxy_ips 127.0.0.1 IP_DE_YOUR_SERVEUR
Eventually, we restart Apache:
service apache2 restart
-
UPDATE DEBIAN
Here, we start by updating the list of Debian sources. For that, we run:
nano /etc/apt/sources.list
Then we add these sources after the repository:
deb http://nginx.org/packages/debian/ wheezy nginx deb-src http://nginx.org/packages/debian/ wheezy nginx
To update the installation, we run:
apt-get update && apt-get upgrade
Later, we install NGINX and stop it immediately:
apt-get install nginx nginx stop service
Then, we go to the NGINX directory:
cd / etc / nginx /
And we edit the configuration of NGINX:
nano nginx.conf
Here, we only need to change the worker_processes to match the number of cores in the processor.
We save the edits.
Then we go to the conf.d folder:
cd conf.d
And we immediately squirt the default configuration:
rm default.conf
Then, re-create the default.conf file:
nano default.conf
We fill it with the following:
server { listen 80 default; server_name _; server_name_in_redirect off; resolver 127.0.0.1; access_log /var/log/ispconfig/httpd/$host/nginx-access.log; location ~ * ^ / var / www / $ host / web / (wp-content | wp-includes) / (. *) . (jpg | jpeg | gif | png | ico | css | zip | tgz | gz | rar | bz2 | doc | xls | exe | pdf | ppt | txt | tar | mid | css | midi | wav | bmp | rtf | js | swf | flv | html | htm | mp3 | mp4) $ { root / var / www / $ host / web / (wp-content | wp-includes); access_log off; expires 30d; set $ memcached_key “$ uri? $ args”; memcached_pass 127.0.0.1:11211; error_page 404 502 504 = @fallback; } location / { root / var / www / $ host / web; index index.html index.htm index.php; access_log off; proxy_pass http://127.0.0.1:82; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header Host $ host; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; } }
Finally, we restart the server:
reboot
Once done, Nginx will activate on all the sites we created with Isp Config.
[Need help with the setup? We are available 24*7]
Conclusion
In short, we saw how our Support Techs go about the Nginx Catch-All Host For ISPConfig 3 query.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments