Nginx Virtualhost Example Rumi, October 1, 2011 Two Virtual Hosts, Serving Static Files http { index index.html; server { server_name www.domain1.com; access_log logs/domain1.access.log main; root /var/www/domain1.com/htdocs; } server { server_name www.domain2.com; access_log logs/domain2.access.log main; root /var/www/domain2.com/htdocs; } } A Default Catchall Virtual Host http { index index.html; server { listen 80 default; server_name _; access_log logs/default.access.log main; server_name_in_redirect off; root /var/www/default/htdocs; } } Wildcard Subdomains in a Parent Folder This is just a really easy way to keep adding new subdomains, or to add new domains automatically when DNS records are pointed at the server. Note that I have included FCGI here as well. If you want to just serve static files, strip out the FCGI config and change the default document to index.html. Rather than creating a new vhost.conf file for every domain, just create one of these: server { # Replace this port with the right one for your requirements listen 80 [default|default_server]; #could also be 1.2.3.4:80 # Multiple hostnames separated by spaces. Replace these as well. server_name star.yourdomain.com *.yourdomain.com; # Alternately: _ root /PATH/TO/WEBROOT/$host; error_page 404 errors/404.html; access_log logs/star.yourdomain.com.access.log; index index.php index.html index.htm; # serve static files directly location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires max; } location ~ \.php$ { include fastcgi_params; fastcgi_intercept_errors on; # By all means use a different server for the fcgi processes if you need to fastcgi_pass 127.0.0.1:YOURFCGIPORTHERE; } location ~ /\.ht { deny all; } } Related Configurations (Linux) nginx
How to setup as DNS client / name server IP address August 26, 2008August 26, 2008 Many new Linux user finds it difficult to setup / modify new name server address (NS1 / NS2). Local name resolution is done via /etc/hosts file. If you have small network then use /etc/hosts file. DNS (domain name service is accountable for associating domain names with ip address, for example… Read More
Install Streama Media Server on Ubuntu 18 May 23, 2020May 24, 2020 Update OS Package: sudo su apt-get upgrade apt-get update reboot Install OpenJDK: apt install openjdk-8-jre mkdir /data mkdir /data/streama touch /data/streama/README.md Add User and change user permission: # new linux user sudo adduser streama # add password to README.md sudo usermod -aG sudo streama sudo chown streama:streama /data/streama/ -R Related Read More
How to Monitor your Linux and Windows Servers with CloudStats May 27, 2017 CloudStats is a server monitoring service which allows you to monitor your whole server infrastructure from a single dashboard interface and helps timely to prevent any kind of technical issues and downtimes. With CloudStats it is possible to monitor Linux servers, including those on CentOS, Debian, Fedora, Ubuntu etc. CloudStats… Read More