diff --git a/app/controllers/api/auth.php b/app/controllers/api/auth.php index a0de860..b5dbc57 100644 --- a/app/controllers/api/auth.php +++ b/app/controllers/api/auth.php @@ -24,6 +24,7 @@ class Auth extends ApiController { self::$tokens = new Token; } +/** public function refresh() { $token = self::$tokens->refresh( self::$authToken->ID ); if ( empty( $token ) ) { @@ -35,4 +36,5 @@ class Auth extends ApiController { } Views::view( 'api.response', ['response' => json_encode( [ $responseType => $response ], true )]); } + */ } \ No newline at end of file diff --git a/app/controllers/api/login.php b/app/controllers/api/login.php index 74536eb..31b79e5 100644 --- a/app/controllers/api/login.php +++ b/app/controllers/api/login.php @@ -31,6 +31,7 @@ class Login extends ApiController { Template::addHeader( 'Content-Type: application/json; charset=utf-8' ); } +/** public function index() { if ( ! Forms::check( 'apiLogin' ) ) { $responseType = 'error'; @@ -47,4 +48,5 @@ class Login extends ApiController { $token = self::$tokens->findOrCreateUserToken( $user->ID, true ); return Views::view( 'api.response', ['response' => json_encode( [ $responseType => $token ], true )]); } + */ } \ No newline at end of file diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 44168f9..8f06841 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -23,6 +23,13 @@ class Users extends ApiController { self::$user = new User; } + /** + * This is actually just for testing. It can provide attack information in the way of user count if not disabled. + * + * @param [type] $id + * @return void + */ +/** public function find( $id = null ) { $user = self::$user->get( $id ); if ( ! $user ) { @@ -34,4 +41,5 @@ class Users extends ApiController { } Views::view( 'api.response', ['response' => json_encode( [ $responseType => $response ], true )]); } + */ } \ No newline at end of file diff --git a/app/controllers/bedrock.php b/app/controllers/bedrock.php new file mode 100644 index 0000000..ca142af --- /dev/null +++ b/app/controllers/bedrock.php @@ -0,0 +1,47 @@ + + * @link https://TheTempusProject.com + * @license https://opensource.org/licenses/MIT [MIT LICENSE] + */ +namespace TheTempusProject\Controllers; + +use TheTempusProject\Hermes\Functions\Redirect; +use TheTempusProject\Bedrock\Functions\Session; +use TheTempusProject\Bedrock\Functions\Check; +use TheTempusProject\Bedrock\Functions\Input; +use TheTempusProject\Hermes\Functions\Route as Routes; +use TheTempusProject\Houdini\Classes\Issues; +use TheTempusProject\Houdini\Classes\Views; +use TheTempusProject\Houdini\Classes\Components; +use TheTempusProject\Houdini\Classes\Template; +use TheTempusProject\Classes\Controller; +use TheTempusProject\Classes\Forms; +use TheTempusProject\TheTempusProject as App; + +class Bedrock extends Controller { + public function index() { + self::$title = '{SITENAME} - Bedrock'; + self::$pageDescription = 'Bedrock is a dependency of {SITENAME} that provides many components used to manipulate database data and many helper functions vital for running the entire application.'; + Views::view( 'deps.bedrock' ); + } + + public function packagist() { + Redirect::external( 'https://packagist.org/packages/thetempusproject/bedrock' ); + } + + public function git() { + Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/bedrock' ); + } + + public function changes() { + self::$title = '{SITENAME} - Bedrock Changes'; + self::$pageDescription = 'Bedrock is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.'; + Views::view( 'changes.bedrock' ); + } +} diff --git a/app/controllers/canary.php b/app/controllers/canary.php new file mode 100644 index 0000000..e93700e --- /dev/null +++ b/app/controllers/canary.php @@ -0,0 +1,47 @@ + + * @link https://TheTempusProject.com + * @license https://opensource.org/licenses/MIT [MIT LICENSE] + */ +namespace TheTempusProject\Controllers; + +use TheTempusProject\Hermes\Functions\Redirect; +use TheTempusProject\Bedrock\Functions\Session; +use TheTempusProject\Bedrock\Functions\Check; +use TheTempusProject\Bedrock\Functions\Input; +use TheTempusProject\Hermes\Functions\Route as Routes; +use TheTempusProject\Houdini\Classes\Issues; +use TheTempusProject\Houdini\Classes\Views; +use TheTempusProject\Houdini\Classes\Components; +use TheTempusProject\Houdini\Classes\Template; +use TheTempusProject\Classes\Controller; +use TheTempusProject\Classes\Forms; +use TheTempusProject\TheTempusProject as App; + +class Canary extends Controller { + public function index() { + self::$title = '{SITENAME} - Canary'; + self::$pageDescription = 'Canary is a dependency of {SITENAME} that both records and reports logs from various PHP applications.'; + Views::view( 'deps.canary' ); + } + + public function packagist() { + Redirect::external( 'https://packagist.org/packages/thetempusproject/canary' ); + } + + public function git() { + Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/canary' ); + } + + public function changes() { + self::$title = '{SITENAME} - Canary Changes'; + self::$pageDescription = 'Canary is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.'; + Views::view( 'changes.canary' ); + } +} diff --git a/app/controllers/hermes.php b/app/controllers/hermes.php new file mode 100644 index 0000000..bea348d --- /dev/null +++ b/app/controllers/hermes.php @@ -0,0 +1,47 @@ + + * @link https://TheTempusProject.com + * @license https://opensource.org/licenses/MIT [MIT LICENSE] + */ +namespace TheTempusProject\Controllers; + +use TheTempusProject\Hermes\Functions\Redirect; +use TheTempusProject\Bedrock\Functions\Session; +use TheTempusProject\Bedrock\Functions\Check; +use TheTempusProject\Bedrock\Functions\Input; +use TheTempusProject\Hermes\Functions\Route as Routes; +use TheTempusProject\Houdini\Classes\Issues; +use TheTempusProject\Houdini\Classes\Views; +use TheTempusProject\Houdini\Classes\Components; +use TheTempusProject\Houdini\Classes\Template; +use TheTempusProject\Classes\Controller; +use TheTempusProject\Classes\Forms; +use TheTempusProject\TheTempusProject as App; + +class Hermes extends Controller { + public function index() { + self::$title = '{SITENAME} - Hermes'; + self::$pageDescription = 'Hermes is a dependency of {SITENAME} that provides many common helper functions for navigating url components and file systems; designed to work seamlessly regardless of architecture.'; + Views::view( 'deps.hermes' ); + } + + public function packagist() { + Redirect::external( 'https://packagist.org/packages/thetempusproject/hermes' ); + } + + public function git() { + Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/hermes' ); + } + + public function changes() { + self::$title = '{SITENAME} - Hermes Changes'; + self::$pageDescription = 'Hermes is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.'; + Views::view( 'changes.hermes' ); + } +} diff --git a/app/controllers/home.php b/app/controllers/home.php index fe71cbc..7629389 100644 --- a/app/controllers/home.php +++ b/app/controllers/home.php @@ -28,7 +28,7 @@ class Home extends Controller { public function index() { self::$title = '{SITENAME}'; self::$pageDescription = '{SITENAME} is here to provide you a better, faster, and easier - way to create and manage your own web applications.'; - Views::view( 'index' ); + Views::view( 'landing' ); } public function login() { @@ -113,4 +113,16 @@ class Home extends Controller { self::$pageDescription = 'Many times, we aren\'t the first to ask why or how something works. Here you will find a list of {SITENAME} commonly asked questions and our best answers.' ; Views::view( 'faq' ); } + + public function libraries() { + self::$title = 'Libraries - {SITENAME}'; + self::$pageDescription = '{SITENAME} depends on several very important libraries, some of which are developed exclusively to support the project. Here you can find a list with more information.' ; + Views::view( 'deps.index' ); + } + + public function getstarted() { + self::$title = 'Get Started - {SITENAME}'; + self::$pageDescription = '{SITENAME} is a great tool to bring your ideas to reality. On this page, you can find out how to get started today.' ; + Views::view( 'start' ); + } } diff --git a/app/controllers/houdini.php b/app/controllers/houdini.php new file mode 100644 index 0000000..c2dd3ba --- /dev/null +++ b/app/controllers/houdini.php @@ -0,0 +1,47 @@ + + * @link https://TheTempusProject.com + * @license https://opensource.org/licenses/MIT [MIT LICENSE] + */ +namespace TheTempusProject\Controllers; + +use TheTempusProject\Hermes\Functions\Redirect; +use TheTempusProject\Bedrock\Functions\Session; +use TheTempusProject\Bedrock\Functions\Check; +use TheTempusProject\Bedrock\Functions\Input; +use TheTempusProject\Hermes\Functions\Route as Routes; +use TheTempusProject\Houdini\Classes\Issues; +use TheTempusProject\Houdini\Classes\Views; +use TheTempusProject\Houdini\Classes\Components; +use TheTempusProject\Houdini\Classes\Template; +use TheTempusProject\Classes\Controller; +use TheTempusProject\Classes\Forms; +use TheTempusProject\TheTempusProject as App; + +class Houdini extends Controller { + public function index() { + self::$title = '{SITENAME} - Houdini'; + self::$pageDescription = 'Houdini is a dependency of {SITENAME} that allows for the creation and manipulation of objects used in html page creation.'; + Views::view( 'deps.houdini' ); + } + + public function packagist() { + Redirect::external( 'https://packagist.org/packages/thetempusproject/houdini' ); + } + + public function git() { + Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/houdini' ); + } + + public function changes() { + self::$title = '{SITENAME} - Houdini Changes'; + self::$pageDescription = 'Houdini is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.'; + Views::view( 'changes.houdini' ); + } +} diff --git a/app/views/about.html b/app/views/about.html index 9604f08..e7df8d8 100644 --- a/app/views/about.html +++ b/app/views/about.html @@ -1,7 +1,14 @@

Welcome to {SITENAME}

- {SITENAME} was built out of a need to create and manage my own web applications. + {SITENAME} was built out of a need to create and manage web applications. + At the time, I had used wordpress but I didn't want or even need any of the blog functionality. + No matter what plugins you add, no matter how you customize layout, wordpress is still a blog at its core. + There is nothing inherently wrong with a blog, but when you start from a blog, everything is a post, or a plugin. + Under the hood, wordpress is going to run how wordpress wants, as a web interface for accessing text records. +

+

+ The Tempus Project was always intended to be a web application, not a blog.

Right now, this entire system was built and managed by myself. As stated, I have used my own version of this for years, but translating it to a publicly available product is not a 1-to-1 job. There may be bugs or issues encountered while you use the product. I can't guarantee a fix for every need in every case immediately, but I do actively keep track of bugs and work hard to ensure everyone has a great experience using the app. diff --git a/app/views/changes/bedrock.html b/app/views/changes/bedrock.html new file mode 100644 index 0000000..8e1df1c --- /dev/null +++ b/app/views/changes/bedrock.html @@ -0,0 +1,9 @@ +

+

Bedrock Changes

+

+ Here you can find a simple list of the important changes made to the Bedrock library. +

+

+ Not all changes may be addressed individually on this page. +

+
\ No newline at end of file diff --git a/app/views/changes/canary.html b/app/views/changes/canary.html new file mode 100644 index 0000000..4ae2151 --- /dev/null +++ b/app/views/changes/canary.html @@ -0,0 +1,9 @@ +
+

Canary Changes

+

+ Here you can find a simple list of the important changes made to the Canary library. +

+

+ Not all changes may be addressed individually on this page. +

+
\ No newline at end of file diff --git a/app/views/changes/hermes.html b/app/views/changes/hermes.html new file mode 100644 index 0000000..b49f868 --- /dev/null +++ b/app/views/changes/hermes.html @@ -0,0 +1,9 @@ +
+

Hermes Changes

+

+ Here you can find a simple list of the important changes made to the Hermes library. +

+

+ Not all changes may be addressed individually on this page. +

+
\ No newline at end of file diff --git a/app/views/changes/houdini.html b/app/views/changes/houdini.html new file mode 100644 index 0000000..c6e4d7b --- /dev/null +++ b/app/views/changes/houdini.html @@ -0,0 +1,9 @@ +
+

Houdini Changes

+

+ Here you can find a simple list of the important changes made to the Houdini library. +

+

+ Not all changes may be addressed individually on this page. +

+
\ No newline at end of file diff --git a/app/views/deps/bedrock.html b/app/views/deps/bedrock.html new file mode 100644 index 0000000..3d63af2 --- /dev/null +++ b/app/views/deps/bedrock.html @@ -0,0 +1,27 @@ +
+
+
+
+ Bootstrap Themes +
+
+

Bedrock

+

+ Bedrock, as the name may suggest, is the core functionality the project is built on. + From Basic text checks to the core functionality behind models and controllers, bedrock handles it all. +

+ +
+
+
+

+ For a list of recent changes, please check here. +

+
\ No newline at end of file diff --git a/app/views/deps/canary.html b/app/views/deps/canary.html new file mode 100644 index 0000000..98b6031 --- /dev/null +++ b/app/views/deps/canary.html @@ -0,0 +1,27 @@ +
+
+
+
+ Bootstrap Themes +
+
+

Canary

+

+ Canary is a library that allows {SITENAME} to add logs during execution. + The resulting logs can be printed to the browser console in real-time, saved to a log file, or even used on-page for debugging. +

+ +
+
+
+

+ For a list of recent changes, please check here. +

+
\ No newline at end of file diff --git a/app/views/deps/hermes.html b/app/views/deps/hermes.html new file mode 100644 index 0000000..291d6b0 --- /dev/null +++ b/app/views/deps/hermes.html @@ -0,0 +1,27 @@ +
+
+
+
+ Bootstrap Themes +
+
+

Hermes

+

+ Hermes is a simple library that provides a small set of commonly used helper functions. + These functions primarily help with navigating the url or file systems in a consistent way across several libraries and projects. +

+ +
+
+
+

+ For a list of recent changes, please check here. +

+
\ No newline at end of file diff --git a/app/views/deps/houdini.html b/app/views/deps/houdini.html new file mode 100644 index 0000000..6596db8 --- /dev/null +++ b/app/views/deps/houdini.html @@ -0,0 +1,27 @@ +
+
+
+
+ Bootstrap Themes +
+
+

Houdini

+

+ Houdini is where the front-end magic happens and it serves as the primary front-end html generator. + It handles the storage and applications of frontend components, all the views, templates, and several other critical features of the front-end. +

+ +
+
+
+

+ For a list of recent changes, please check here. +

+
\ No newline at end of file diff --git a/app/views/deps/index.html b/app/views/deps/index.html new file mode 100644 index 0000000..a0ca9f7 --- /dev/null +++ b/app/views/deps/index.html @@ -0,0 +1,47 @@ +
+

{SITENAME} Libraries

+

+ {SITENAME} uses a number of libraries developed in conjunction with the main project. Here you can find a list of these libraries with more information on each. +

+
+ +
\ No newline at end of file diff --git a/app/views/landing.html b/app/views/landing.html new file mode 100644 index 0000000..7c24c3f --- /dev/null +++ b/app/views/landing.html @@ -0,0 +1,145 @@ +
+ +

The Tempus Project

+
+

+ {SITENAME} allows you to quickly develop, design, and customize responsive mobile-first web applications. +

+
+ +
+ +
+

+ Utilizing our in-house libraries, {SITENAME} provides a very basic PHP web application utilizing the MVC (Model View Controller) pattern, paired with Bootstrap for a robust front-end experience. {SITENAME} can be deployed on most server architecture in seconds and can be installed and customized within minutes. Paired with Bootstrap, the world's most popular front-end open source toolkit, you have a great platform to build just about anything. +

+
+ +
+ +
+

Includes many systems right oout of the box

+
+
+
+ +
+
+

User Management

+

From new user registrations to forgotten password recovery and everything in-between, the included authentication and authorization controls can handle all your needs and include groups with highly customizable permissions systems.

+
+
+
+
+ +
+
+

Administration

+

+ Everything from your sitename and timezone to notifications and emails are a breeze with the included Admin panel. Out of the box you will have direct control over most of your application and you can easily expand or add new controls as you need. +

+
+
+
+
+ +
+
+

Plugins

+

+ One of the best features of {SITENAME} is the plugin functionality. Much of the system has been modeled to work as self-contained applications that work together. Many of the features available here are plugins aty their core. +

+
+
+
+
+ +
+ +
+

Plugins

+
+
+ +
+

Blog

+

Whether its the companies transparency or your own need to share, our blog plugin makes it simple.

+
+
+
+ +
+

Bug Reports

+

An unfortunate reality iis that every application has bugs, never leave your users without the ability to report them to you.

+
+
+
+ +
+

Comments

+

Allowing users the opportunity to share feedback is crucial. Our comments plugin not only integrates with the blog, but many other plugins to enable users to comment on any content you want.

+
+
+
+ +
+

Contact

+

A contact form is another simple but essential tool for your business or website.

+
+
+
+ +
+

Resume

+

Whether you're looking for a new gig or just want an easy way for others to see your work, our resume plugin might be the key.

+
+
+
+ +
+

Subscribe

+

Building your list should always be a part of your application and services and it made as simple as can be with this plugin.

+
+
+
+ +
+

WIP (Work in Progress)

+

A light-weight and simple plugin that allows you to keep a running list of works in progress to share with site visitors..

+
+
+
+ +
+

Memberships / Payments

+

Our membership plugin integrates with Stripe to allow incredibly simple membership setup and can be easily expanded to sell any of your products.

+
+
+
+
+ +
+ +

Light / Dark Modes

+
+
+
+

When you stick with the light

+

everything looks great.

+
+
+
+
+
+
+

But when you go to the dark side

+

everything is just a bit better.

+
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/start.html b/app/views/start.html new file mode 100644 index 0000000..f96a12d --- /dev/null +++ b/app/views/start.html @@ -0,0 +1,23 @@ +
+

Getting Started with {SITENAME}

+

+ {SITENAME} has been open source for many years now. The hopes and intentions for it were always to give others a leg-up to get started building web-apps like i wish i had as a kid. + There were so many tutorials and ideas, expansions and plans for the project. + Unfortunately no person is given unlimited time to accomplish their dreams and over the years the idea for a huge repository for learning and education has taken a back seat. +

+

+ At this time, the best recommendation available is to contact us for more information. + The site here is actively maintained so feel free to utilize any of our available resources for contact. + In addition to the site here, you can contact the lead developer (me) directly through JoeyKimsey.com. +

+

+ Right now, this entire system was built and managed by myself. As stated, I have used my own version of this for years, but translating it to a publicly available product is not a 1-to-1 job. There may be bugs or issues encountered while you use the product. I can't guarantee a fix for every need in every case immediately, but I do actively keep track of bugs and work hard to ensure everyone has a great experience using the app. +

+

+ If you encounter any bugs, feel free to report them here. Likewise, there are forms for feedback, reviews, suggestions, and a general contact form. Thanks for taking the time to check out the product! +

+
+ {loggedin}Report a Bug{/loggedin} + Contact Us +
+
\ No newline at end of file diff --git a/bin/tempus_project.php b/bin/tempus_project.php index 1184cc9..4fe4803 100644 --- a/bin/tempus_project.php +++ b/bin/tempus_project.php @@ -140,6 +140,14 @@ class TheTempusProject extends Bedrock { 'text' => 'Home', 'url' => '{ROOT_URL}home/index', ], + [ + 'text' => 'Libraries', + 'url' => '{ROOT_URL}home/libraries', + ], + [ + 'text' => 'Get Started', + 'url' => '{ROOT_URL}home/getstarted', + ], [ 'text' => 'Admin', 'url' => '{ROOT_URL}admin/index', diff --git a/images/bedrock.jpg b/images/bedrock.jpg new file mode 100644 index 0000000..10179d6 Binary files /dev/null and b/images/bedrock.jpg differ diff --git a/images/canary.jpg b/images/canary.jpg new file mode 100644 index 0000000..4ca0b1f Binary files /dev/null and b/images/canary.jpg differ diff --git a/images/hermes.jpg b/images/hermes.jpg new file mode 100644 index 0000000..3c08ea4 Binary files /dev/null and b/images/hermes.jpg differ diff --git a/images/houdini.jpg b/images/houdini.jpg new file mode 100644 index 0000000..888b849 Binary files /dev/null and b/images/houdini.jpg differ diff --git a/server/nginx.conf b/server/nginx.conf new file mode 100644 index 0000000..915ea54 --- /dev/null +++ b/server/nginx.conf @@ -0,0 +1,25 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +error_log /var/log/nginx/error.log; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 768; +} + +http { + tcp_nopush on; + types_hash_max_size 2048; + include /etc/nginx/mime.types; + default_type application/octet-stream; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_prefer_server_ciphers on; + + access_log /var/log/nginx/access.log; + + gzip on; + include /etc/nginx/sites-enabled/*; + + include /etc/nginx/conf.d/*.conf; +} \ No newline at end of file diff --git a/server/setup.md b/server/setup.md new file mode 100644 index 0000000..e534733 --- /dev/null +++ b/server/setup.md @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +apt-get update +sudo add-apt-repository ppa:ondrej/php +apt-get update +sudo apt-get install php8.2-cli php8.2-fpm +sudo apt install php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-imagick php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-opcache php8.2-soap php8.2-zip php8.2-redis php8.2-intl unzip -y + + + + + + + + + + + + + + + + +mkdir /etc/nginx/ssl/ +chmod -R 655 /etc/nginx/ssl +chown -R www-data:www-data /etc/nginx/ssl + + + + + + + +mkdir /etc/nginx/sites-available/old/ +sudo mv /etc/nginx/sites-available/* /etc/nginx/sites-available/old/ +sudo touch /etc/nginx/sites-available/thetempusproject.com.conf + + + + + +sudo rm -rf /etc/nginx/sites-enabled/* +sudo ln -s /etc/nginx/sites-available/thetempusproject.com.conf /etc/nginx/sites-enabled/thetempusproject.com.conf +sudo systemctl restart nginx.service + + + + + +cd ~ +curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php + +HASH=`curl -sS https://composer.github.io/installer.sig` + +php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" + + +sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer + + + + + + + + +cd /var/www/ +composer create-project thetempusproject/thetempusproject thetempusproject.com + + +sudo ln -s /etc/nginx/sites-available/black-airplane /etc/nginx/sites-enabled/ + + + + + + + + + + + +1Ag5calIO8xXwS + + + +mysql + + +CREATE USER 'ttp'@'localhost' IDENTIFIED BY '1Ag5calIO8xXwS'; +GRANT ALL PRIVILEGES ON * . * TO 'ttp'@'localhost'; + +FLUSH PRIVILEGES; +CREATE DATABASE ttp; \ No newline at end of file diff --git a/server/thetempusproject.com.conf b/server/thetempusproject.com.conf index a047471..8af76c6 100644 --- a/server/thetempusproject.com.conf +++ b/server/thetempusproject.com.conf @@ -1,36 +1,24 @@ -# upstream to abstract backend connection(s) for php -upstream php { - server unix:/run/php/php8.1-fpm.sock; +upstream php { + server unix:/run/php/php8.2-fpm.sock; } -server { - listen 80; - listen [::]:80; - server_name thetempusproject.com; - include snippets/well-known; - return 301 https://$host$request_uri; -} -server { - listen 443 ssl http2 default_server; - listen [::]:443 ssl http2 default_server; - server_name thetempusproject.com; - include snippets/ssl-params.conf; - root /var/www/thetempusproject.com; - index index.php; - # max php upload size - client_max_body_size 100M; - - # disable direcory indexing - autoindex off; +server { + listen 80 default_server; + index index.php; + server_name thetempusproject.com; + root /var/www/thetempusproject.com; + charset utf-8; + sendfile off; + client_max_body_size 100m; # custom TTP code include snippets/ttp.conf; - + location ~* \.php$ { - fastcgi_pass php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - fastcgi_intercept_errors on; + fastcgi_pass php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + fastcgi_intercept_errors on; } } \ No newline at end of file diff --git a/server/ttp.conf b/server/ttp.conf index e60d201..134ba22 100644 --- a/server/ttp.conf +++ b/server/ttp.conf @@ -6,8 +6,6 @@ error_log /var/log/nginx/error.log; index index.php; -charset utf-8; - error_page 404 /index.php; ssl_certificate /etc/nginx/ssl/thetempusproject.com.pem; @@ -17,7 +15,7 @@ location = /favicon.ico { log_not_found off; access_log off; } - + location = /robots.txt { allow all; log_not_found off; @@ -40,7 +38,7 @@ location ~ /\. { deny all; } -location ~* \.(?:js|css|png|jpg|gif|ico|woff|ttf|woff2)$ { +location ~* \.(?:js|css|png|jpg|gif|ico|woff|tff|woff2|min.css.map)$ { access_log off; log_not_found off; } @@ -69,6 +67,27 @@ location /errors/ { try_files $uri /index.php?error=$uri; } +location /api/ { + # Handle CORS for all requests + if ($request_method = 'POST') { + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Authorization, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length, Content-Range' always; + } + # Handle preflight requests + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Headers' 'Authorization, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range' always; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain; charset=utf-8' always; + return 204; # Return no content for preflight + } + + rewrite ^/(.+)$ /index.php?url=$1&$args; +} + location / { rewrite ^/(.+)$ /index.php?url=$1&$args; -} \ No newline at end of file +} +