LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-02-2018, 05:58 AM   #1
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Rep: Reputation: Disabled
Nginx slim framework not working with try_file settings


I am very new to nginx so I have two different application running on it. I have one which is pure php I store it at /var/www/html/app1 so this runs well. Next I want to build api links. So first I did this

composer create-project slim/slim-skeleton
I want to use the slim framework.So the slim-skeleton folder I renamed it as apitest. Next I adjusted my nginx config file its as below. Below I added this configuration

Code:
location /apitest {
        try_files $uri /public/index.php$is_args$args;
        }
Here is the full nginx.conf. But whenener I try to run http://mip/apiv1 I am getting 404 not found. What else could be wrong or needed to be added for the slim to work.
Code:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    server_tokens off;
    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/blockuseragents.rules;
    limit_conn_zone $binary_remote_addr zone=addr:5m;
    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        #root         /usr/share/nginx/html;
        root         /var/www/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;



        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
        if ($request_method !~ ^(GET|HEAD|POST)$) {
            return 444;
        }
        limit_conn addr 1;

        location /apitest {
        try_files $uri /public/index.php$is_args$args;
        }


    }
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct method to setup Slim framework and setting url rewrite newbie14 Programming 2 02-23-2018 09:58 PM
LXer: How to Install Laravel 5 PHP Framework with Nginx on Ubuntu 16.04 LXer Syndicated Linux News 0 12-15-2017 12:54 PM
Discussion: is it possible to combine video framework and media framework in kernel? happycrab Linux - Kernel 1 09-06-2014 03:51 AM
INET framework not working in OMNET ++ mulyead Linux - Newbie 0 12-04-2013 09:44 PM
slim login problem - anyone succeed in configuring slim? rkrishna Slackware 20 02-18-2008 06:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration