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
Repeat a Linux Command Every X Seconds Forever- using watch July 29, 2019 Use watch Command Watch is a Linux command that allows you to execute a command or program periodically and also shows you output on the screen. This means that you will be able to see the program output in time. By default watch re-runs the command/program every 2 seconds. The… Read More
Virtuabox: Quick installation on Debian Linux September 17, 2011 step-1 ====== install debian step-2 ======= checking if 'synaptic' 'gedbi' are installted step-3 ====== install xrdp for remote installation step-4 ======== installing webmin Related Read More
Increasing Attachment Size in Posfix July 19, 2019 Postfix by default restrict attachment size to approx 10MB i.e. 10240000 bytes. You can check it using following command: postconf | grep message_size_limit To change attachment-size to say 50 MB, run a command like: postconf -e message_size_limit=52428800 Note: If you are running a mail-server with SMTP/IMAP access, you need to change… Read More