Nginx (pronounced "engine-ex") can be used as an open source reverse proxy server, as well as a load balancer, HTTP cache, and not to forget a fast and powerful web server.
- Ubuntu server
Okay so here's the setup: | |
[-] The primary server API is exposed via Flask (Python) and all static files, including all html, css, js is served by nginx. | |
[-] Python is exposing an API at url http://domain.com/api/download/<file_id>, where file_id is a database id for the file that we're interested in downloading. | |
1. User wants to download a file, so we spawn a new window with the url '/api/download/<file_id>' | |
2. Nginx intercepts the request, sees that it starts with /api/, and then forwards the request to Flask, which is being served on port 5000. | |
3. Flask routes the request to its download method, retrieves the pertinent data from the file_id, and constructs additional header settings to make nginx happy and to force the browser to see the file stream as a download request instead of the browser just trying to open the file in a new window. Flask then returns the modified header stream to nginx | |
4. Nginx is finally ready to do some work. While parsing the headers for the incoming request, it encounters "X |
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: php-fpm | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts php-fpm daemon | |
# Description: starts php-fpm daemon |
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
//CSS | |
<?php | |
$test_license = ''; | |
$license_data = ''; | |
define( 'DT_KEY', 'edd_sample_theme_license_key_status'); | |
define( 'EDD_SL_STORE_URL', 'https://codenpy.com' ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */ | |
define( 'EDD_SL_THEME_NAME', 'Industrue - Industrial & Factory WordPress Theme' ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */ | |
if ( !class_exists( 'EDD_SL_Theme_Updater' ) ) { | |
include( dirname( __FILE__ ) . '/edd-class-file-here.php' ); | |
} |
<?php | |
$test_license = ''; | |
$license_data = ''; | |
define( 'DT_KEY', 'edd_sample_theme_license_key_status'); | |
define( 'EDD_SL_STORE_URL', 'https://codenpy.com' ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */ | |
define( 'EDD_SL_THEME_NAME', 'Industrue - Industrial & Factory WordPress Theme' ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */ | |
if ( !class_exists( 'EDD_SL_Theme_Updater' ) ) { | |
include( dirname( __FILE__ ) . '/edd-class-file-here.php' ); | |
} |
#This was done by some tool, don't know which one, and our custom built app captured theese URL's, after filtering | |
#for unique URL's, here is list of URL's in original form, I will later try to create some protection | |
/3B1728A10D221805D2CABE58B095D353.php | |
/manager/html | |
/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php | |
/mysql/mysqlmanager/index.php | |
/mysql/sqlmanager/index.php | |
/mysql/dbadmin/index.php | |
/mysql/admin/index.php | |
/phpmy/index.php |
<VirtualHost *:{PORT}> | |
ServerName www.yourdomain.com | |
ServerAdmin mail@domain.com | |
DocumentRoot /var/www/yourdir/ | |
<Directory /var/www/yourdir> | |
Options Indexes FollowSymLinks | |
AllowOverride all | |
Order allow,deny |
# --------------------------------------- | |
# Main Module | |
# --------------------------------------- | |
user nginx; | |
# This number should be, at maximum, the number of CPU cores on your system. | |
worker_processes 2; | |
pid /var/run/nginx.pid; | |
# Only log critical errors |