How To Configure A Nginx Reverse Proxy With Apache
Nginx can as a reverse proxy to Apache. Nginx does best at serving static content extremely fast whereas Apache can process dynamic content and use all of the various Apache modules and .htaccess that are typically the web standard of hosting. This guide assumes you already have a Apache installation and would like to add Nginx on top of it. If you still need to install Apache please see https://linuxadmin.io/compile-apache-2-4-source/. Essentially what you are using with this guide is using nginx as a media/static content server and passing the rest of the requests to Apache. This combination can greatly improve performance over just a standard Apache web server.
You will first need to install Nginx, this guide will walk you through compiling nginx from source.
Setup Nginx Reverse Proxy
First edit the nginx configuration and add the following:
server {
listen 80;
root /var/www/html/;
index index.php index.html index.htm;
server_name domain.com;
location / {
root /var/www/html;
index index.html index.htm;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_read_timeout 1200;
proxy_send_timeout 1200;
proxy_connect_timeout 75;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location ~* ^.+.(jpg|gif|jpeg|ico|avi|mpeg|mpg|wmv|png|css|js|xml)$ {
root /var/www/html;
}
}
The proxy lines allow Nginx to to grab PHP or any other files from the Apache web server which you will reconfigure to run on port 8080. If a request matches the second location block (jpg|gif|ico|avi|mpeg|mpg|wmv|pgn|css|js|xml) it will be served directly by nginx, taking the load off the Apache web server.
Reconfigure Apache
You will then want to edit your Apache configuration
vim /etc/httpd/conf/httpd.conf
and replace
Listen 80
with
Listen 8080
You will also want to update any virtual hosts to no longer use port 80
<VirtualHost 192.168.1.100:80>
Should now become
<VirtualHost 127.0.0.1:8080>
This will allow Apache to bind on the local interface only serving local requests from Nginx.
You will then want to restart both services to load the new configurations
service httpd restartservice nginx restart
Once you have completed that, Nginx will handle the initial request to port 80 and if a file type is not matched it will send it Apache to delivery the requested resource.
May 23, 2017LinuxAdmin.io
Nginx Load Balancing – LinuxAdmin.io
Nginx can be used as a load balancer to multiple back-end web servers using the proxy functions. This guide will cover the basics of configuring the proxy server to pull from the other web servers. It assumes you already have completed the initial install of Nginx. If you do not already have a install please see Nginx Compile From Source On CentOS.
You will want to create a new configuration (or add to an existing one)
nano /etc/nginx/load-balancer.conf
Insert the following:
upstream cluster {
server 192.168.100.10;
server 192.168.100.11;
server 192.168.100.12;
}
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://cluster;
}
}
And save the file. You will want to substitute the 192.168.100.xx IP addresses with addresses of each of the web servers you want to send requests too. Once you have completed the load balancing configuration, you will want to restart Nginx to load the new configuration
service nginx restart
Nginx Load Balancing Methods
There are a couple of different clustering types you can utilize each will direct traffic differently
Round Robin
by default without specifying one, round-robin will be used. Sending each new request to a different server.
upstream cluster {
ip_hash;
server 192.168.100.10;
server 192.168.100.11;
server 192.168.100.12;
}
ip_hash will send all subsequent requests from the same IP address to the same server. This is useful if you need sessions to persist on the same server for the same IP address.
Least Connections
upstream cluster {
least_conn;
server 192.168.100.10;
server 192.168.100.11;
server 192.168.100.12;
}
least_conn will send new requests to the server with the least amount of active connections. This is useful for balancing each server equally.
Weighted Load Balancing
upstream cluster {
server 192.168.100.10 weight=3;
server 192.168.100.11 weight=1;
server 192.168.100.12 weight=1;
}
Specifying a weight will distribute more requests to servers with a higher weight. In the above example for each 5 requests, 3 will be sent to 192.168.100.10, and one request will be sent to each of other 2 servers. This is useful in situations where you might have one server which is more powerful than the others or you would like to do testing and control a portion of traffic going to a specific server.
How to change the hostname of your Linux machine without needing to restart — The Ultimate Linux Newbie Guide
hostnamectl method
Since Ubuntu 16.04 (and most recent Linux distros) use Systemd you can simply use the hostnamectl command to change hostname. To see current setting, run your Terminal just type the following command:
$ hostnamectl
Sample output:
Static hostname: lappy686 Icon name: computer-laptop Chassis: laptop Machine ID: 52ff3d3eefa19d99891c3cf4b70a138b Boot ID: fefe3aaf139855243a837001fedc7713 Operating System: Ubuntu 18.04 Kernel: Linux 4.16.0-33-generic Architecture: x86-64 |
To change hostname from lappy686 to ulng-laptop, enter:
$ hostnamectl set-hostname ulng-laptop
Type hostnamectl again to see that the hostname has updated.
Classic Method
If you don’t have such a new machine, then you can perform the following steps:
Type the following commands:
$ sudo hostname new-hostname-here
Next edit the /etc/hostname file and update hostname:
$ sudo nano /etc/hostname
Finally, edit the /etc/hosts file and update the lines that contain your old hostname:
$ sudo nano /etc/hosts
From:
127.0.1.1 old-host-name
To:
127.0.1.1 new-hostname-here
Save and close the file.
How a Development Company Creates Your Unique Business App – ThisHosting.Rocks
Developing mobile apps for your business is one of the most crucial steps to make sure that your company becomes a household name. However, you must keep in mind that every day hundreds and thousands of apps are being developed all around the world and many of them belong to your specific category.
When you contact a company that develops mobile apps, you must be aware of the processes they use to create your product app so you can be sure about the quality of the app. Here are some of the major aspects of developing an app that can guarantee its success:
App Concept
The first thing that you need to focus on is coming up with a great app concept. It is important that your app provides your target customers with a certain value. The app should also resolve a particular problem that is common in your industry. In this fast-changing domain of app development, there is always fierce competition and in order to stay ahead of the game, you should make your app different from the rest. Therefore, it is necessary that you do a lot of market research so that you can come up with great ideas on making an app that is way ahead of the rest.
App Strategy
Once you have a well-placed app concept, you must come up with an app strategy that ensures its success. For this, you will have to study your app competition and find out the ideas they are coming up with. You will also have to monetize your app since in all probability you are looking to make money out of it. Some of the app monetization methods that can work include in-app purchases, premium features, subscription payments, selling user data, ad-revenue as well as traditional paid apps. The next important aspect of your app strategy would involve the ways you choose to promote and market your app. Promoting anything isn’t easy. And you should do further research on the best ways to market your app. Most common marketing technique for apps is SEO. You will also need to envision a roadmap for your app to understand the prospects of your app in the coming future. This will help you to come up with ways to expand your app and make it more valuable to your audience.
Designing user experience
When you are looking to design the user experience of your app, you will need to deal with the information architecture that will help you to decide what kind of functionality and data must be presented in the app and the ways in which they can be organized. The other important aspect of planning the user experience is to implement workflows that can help your users navigate the app. This also helps in making the app more user-friendly. You will also have to come up with click-through models for testing the wireframes and workflows.
User-interface design
This is the step that involves creating the aesthetic elements of the app. You will have to work with style guides that can serve as major cornerstones for deciding on the look of your app. The next thing you will need to work with is rendered design. The rendered design works as a process through which you can take the wireframes and then replace grayscale elements with unique elements from the style guide. Mockplus has a great list of UI designs you can use for inspiration. You can find thousands of great designs online. Finally, you will have to test the app using rendered click-through models to make sure that the design is working perfectly.
Designing the app with a Tech Stack
This step involves the front end and back end design with a number of important technologies. The way you manage the front end designing of the app at this phase determines whether it is a native or hybrid app. The back-end development focuses on the language, database and hosting environment that determines the scalability of the code writing process. Make sure to pay extra attention to the hosting provider you choose and whether or not it supports the software and services you’re planning on using.
This is just the tip of the iceberg when it comes to app development. You can do your own research and learn more about each step of the process, or you can get an app development company to do it all for you.
About the Author
This article was submitted to us by a third-party writer. The views and opinions expressed in this article are those of the author and do not reflect the views and opinions of ThisHosting.Rocks. If you want to write for ThisHosting.Rocks, go here.
Peter Kudlacek is a CEO at Apro Software. Peter has done outsourcing for the last 15 years and after all those years they pretty much nailed their software development processes.
How to Play Windows-only Games on Linux with Steam Play
The new experimental feature of Steam allows you to play Windows-only games on Linux. Here’s how to use this feature in Steam right now.
You have heard the news. Game distribution platform Steam is implementing a fork of WINE to allow you to play games that are available on Windows only. This is definitely a great news for us Linux users for we have complained about the lack of the number of games for Linux.
This new feature is still in beta but you can try it out and play Windows-only games on Linux right now. Let’s see how to do that.
Play Windows-only games in Linux with Steam Play
You need to install Steam first. Steam is available for all major Linux distributions. I have written in detail about installing Steam on Ubuntu and you may refer to that article if you don’t have Steam installed yet.
Once you have Steam installed and you have logged into your Steam account, it’s time to see how to enable Windows games in Steam Linux client.
Step 1: Go to Account Settings
Run Steam client. On the top left, click on Steam and then on Settings.
Step 2: Opt in to the beta program
In the Settings, select Account from left side pane and then click on the CHANGE button under Beta participation.
You should select Steam Beta Update here.
Once you save the settings here, Steam will restart and download the new beta updates.
Step 3: Enable Steam Play beta
Once Steam has downloaded the new beta updates, it will be restarted. Now you are almost set.
Go to Settings once again. You’ll see a new option Steam Play in the left side pane now. Click on it and check the boxes:
- Enable Steam Play for supported titles (You can play the whitelisted Windows-only games)
- Enable Steam Play for all titles (You can try to play all Windows-only games)
I don’t remember if Steam restarts at this point again or not but I guess that’s trivial. You should now see the option to install Windows-only games on Linux.
For example, I have Age of Empires in my Steam library which is not available on Linux normally. But after I enabled Steam Play beta for all Windows titles, it now gives me the option for installing Age of Empires on Linux.
Windows-only games can now be installed on Linux
Things to know about Steam Play beta feature
There are a few things you should know and keep in mind about using Windows-only games on Linux with Steam Play beta.
- At present, only 27 Windows-games are whitelisted for Steam Play. These whitelisted games work seamlessly on Linux.
- You can try any Windows game with Steam Play beta but it might not work all the time. Some games will crash sometimes while some game might not run at all.
- While in beta, you won’t see the Windows-only games available for Linux in the Steam store. You’ll have to either try the game on your own or refer to this community maintained list or a better-looking web version of the same to see the compatibility status of the said Windows game. You can also contribute to the list by filling this form.
- If you have games downloaded on Windows via Steam, you can save some download data by sharing Steam game files between Linux and Windows.
I hope this tutorial helped you in running Windows-only games on Linux. Which game(s) are you looking forward to play on Linux?
About Abhishek Prakash
I am a professional software developer, and founder of It’s FOSS. I am an avid Linux lover and Open Source enthusiast. I use Ubuntu and believe in sharing knowledge. Apart from Linux, I love classic detective mysteries. I’m a huge fan of Agatha Christie’s work.
Download PostgreSQL Linux 11.0
PostgreSQL is an open source, powerful, reliable, stable, enterprise-ready and free object-relational database system in the style of MariaDB, MySQL or SQLite projects. It’s an ACID (Atomicity, Consistency, Isolation, Durability) compliant database server/engine that can be highly customized and includes numerous attractive features, making a great replacement for the aforementioned database engines.
Features at a glance
Key features include support for foreign keys, views, joins, triggers and stored procedures, support for multiple languages, support for a wide range of SQL data types, including BOOLEAN, CHAR, INTEGER, NUMERIC, VARCHAR, INTERVAL, TIMESTAMP and DATE.
In addition, the software comes with support for storaging binary large objects, including all sorts of multimedia files (video, audio and photo), and provides developers with native programming interfaces for the C, C++, Python, Perl, Ruby, Java, .Net, Tcl and ODBC programming languages.
Among other interesting features, we can mention MVCC (Multi-Version Concurrency Control), tablespaces, multibyte character encodings, point in time recovery, a mature query optimizer and planner, asynchronous replication, online backups, nested transactions (popularly known as savepoints), hot backups, write ahead logging for fault tolerance, support for international character sets, as well as Unicode support.
PostgreSQL in numbers
At the moment, the PostgreSQL database server supports unlimited size for databases, 32 TB should be the maximum size for tables, 1.6 TB per row, 1 GB per field, unlimited rows per table, supports between 250 and 1600 columns per table, depending on column types, and supports unlimited indexes per table.
Supported operating systems
The PostgreSQL has been successfully tested on all mainstream operating systems, including GNU/Linux, BSD, Solaris, HP-UX, AIX, SGI IRIX, Solaris, Tru64, Mac OS X and Microsoft Windows. PostgreSQL is available for download as a universal source archive, as well as pre-compiled binary packages for many Linux distributions, supporting both 32-bit and 64-bit architectures.
Linux Today – How to install the NVIDIA drivers on Ubuntu 18.10 Cosmic Cuttlefish Linux
Oct 23, 2018, 06:00
The objective of this article is to install the NVIDIA drivers on Ubuntu 18.10 Cosmic Cuttlefish Linux. This article will discuss three methods of Nvidia driver installation in the following order: 1. Automatic Install using standard Ubuntu Repository. 2. Automatic Install using PPA repository to install Nvidia Beta drivers. 3. Manual Install using the Official nvidia.com driver.
Related Stories:
- Desktop plans for Ubuntu 18.10(May 20, 2018)
- Cue the Cosmic Cuttlefish(May 09, 2018)
- Ubuntu 18.10 Cosmic Cuttlefish New Features(Sep 18, 2018)
- Here’s the New Login Screen of Ubuntu 18.10 (Cosmic Cuttlefish) with Yaru Theme(Aug 01, 2018)
- Ubuntu 18.10 (Cosmic Cuttlefish) Enters Feature Freeze, Beta Lands September 27(Aug 28, 2018)
- Ubuntu 18.10 Brings Cosmic Cuttlefish to the Linux Desktop(Oct 12, 2018)
- Mark Shuttleworth Details Ubuntu 18.10 Cosmic Cuttlefish Linux Release(Oct 19, 2018)
Corsair Force MP510 240GB NVMe SSD Ubuntu Linux Benchmarks Review
Last week Corsair announced the Force Series MP510 M.2 PCIe NVMe solid-state drives as the company’s fastest SSDs to date. While being Corsair’s latest and fastest NVMe SSDs, the pricing is competitive with the 240GB model starting out at $70 USD, 480GB for $130 USD, $239 for 960GB, or $475 for a 1920GB version.
Given a number of Phoronix readers asking about MP510 Linux benchmarks (including some premium supporters), I ended up buying a MP510 240GB solid-state drive for carrying out some Linux tests as Corsair hadn’t supplied any review samples for Linux benchmarking.
The Corsair Force MP510 240GB model is rated for sequential reads up to 3100MB/s, sequential writes up to 1050MB/s, random writes up to 240K IOPS, and random reads up to 180k IOPS. The MP510 SSD relies upon 3D TLC NAND Toshiba memory and a Phison PS5012-E12 controller. The MP510 drive is rated for 400 TBW endurance, 1.8 million hours MTBF, and is backed by Corsair with a five-year warranty.
These fresh NVMe SSD benchmarks were done on Ubuntu 18.10 while using an EXT4 file-system and the stock Linux 4.18 kernel. Tests were done using a Ryzen 7 2700X system and the different solid-state drives benchmarked for this comparison included the following NVMe SSDs: Corsair Force MP500 120GB, Corsair Force MP500 240GB, Intel 600p 256GB, Intel 800p 128GB, Samsung 950 PRO 256GB, and Samsung 970 EVO 256GB. Some older SATA 3.0 SSDs were also freshly benchmarked for reference purposes on Ubuntu 18.10. Those SATA 3.0 SSDs included the Toshiba TR-150 120GB, Samsung 860 EVO 500GB, and Samsung 850 PRO 256GB.
All of these solid-state drive benchmarks were carried out via the Phoronix Test Suite. If you want to see how your own Linux storage performance compares to the benchmarks shown in this article, simply install the Phoronix Test Suite and then run phoronix-test-suite benchmark 1810208-SK-CORSAIR5106 for your own fully-automated, side-by-side benchmark comparison.
Install The ngx_cache_purge Module In Nginx
Ngx_cache_purge is a module which will allow the fastcgi_cache, proxy, SCGI and uWSGI caches to have content purged from them. The caches allow precompiled code to be served as opposed to running a new version each time. This can greatly reduce the amount of processing power per page request. This specific module allows that cached content to be purged when needed. To compile this module from source if you have done a source build of Nginx like this Nginx Compile From Source On CentOS. Adding the module is pretty straightforward. You can read more about the module here
First get the ngx_cache_purge package
wget -O /usr/src/ngx_cache_purge-2.3.tar.gz http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
Uncompress the package
tar xfvz ngx_cache_purge-2.3.tar.gz
cd to your Nginx build directory
cd /usr/src/nginx-1.11.13
Get the prior build configuration options
# nginx -V
nginx version: nginx/1.11.13
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: –user=nginx –group=nginx –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –with-http_gzip_static_module –with-http_stub_status_module –with-http_ssl_module –with-pcre –with-file-aio –with-http_realip_module –without-http_scgi_module –without-http_uwsgi_module –with-http_realip_module
Copy all of the configure arguments and append –add-module=/path/to/ngx_cache_purge
./configure –user=nginx –group=nginx –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –with-http_gzip_static_module –with-http_stub_status_module –with-http_ssl_module –with-pcre –with-file-aio –with-http_realip_module –without-http_scgi_module –without-http_uwsgi_module –with-http_realip_module –add-module=/usr/src/ngx_cache_purge-2.3
Once configure has finished, You can go ahead perform a make and install it
make
make install
Then restart nginx
/etc/init.d/nginx restart
Run the following to ensure the module is now loaded:
nginx -V 2>&1 | grep ngx_cache_purge -o
It should return ngx_cache_purge if it is.
That is all you need to do to add the module to a Nginx build.
May 28, 2017LinuxAdmin.io