Skip to content

Commit edbde34

Browse files
committed
update setup nginx
1 parent 8949b8e commit edbde34

File tree

2 files changed

+52
-16
lines changed

2 files changed

+52
-16
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
class Example extends CI_Controller {
5+
6+
/**
7+
* Index Page for this controller.
8+
*
9+
* Maps to the following URL
10+
* http://example.com/index.php/welcome
11+
* - or -
12+
* http://example.com/index.php/welcome/index
13+
* - or -
14+
* Since this controller is set as the default controller in
15+
* config/routes.php, it's displayed at http://example.com/
16+
*
17+
* So any other public methods not prefixed with an underscore will
18+
* map to /index.php/welcome/<method_name>
19+
* @see https://codeigniter.com/user_guide/general/urls.html
20+
*/
21+
public function index()
22+
{
23+
echo "<pre>";
24+
print_r("hello");
25+
}
26+
}

site.conf

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
server {
2-
listen 90;
3-
index index.php index.html;
4-
server_name localhost;
5-
error_log /var/log/nginx/error.log;
6-
access_log /var/log/nginx/access.log;
7-
root /public;
2+
listen 90 default_server;
3+
index index.php index.html;
4+
root /public;
5+
access_log /var/log/nginx/access.log;
6+
error_log /var/log/nginx/error.log;
87

9-
location ~ \.php$ {
10-
try_files $uri =404;
11-
fastcgi_split_path_info ^(.+\.php)(/.+)$;
12-
fastcgi_pass php:9000;
13-
fastcgi_index index.php;
14-
include fastcgi_params;
15-
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
16-
fastcgi_param PATH_INFO $fastcgi_path_info;
17-
}
18-
}
8+
# set client body size#
9+
client_max_body_size 8M;
10+
11+
location / {
12+
try_files $uri /index.php?$args;
13+
}
14+
location ~ \.php$ {
15+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
16+
fastcgi_pass php:9000;
17+
fastcgi_index index.php;
18+
include fastcgi_params;
19+
fastcgi_param SCRIPT_FILENAME /public$fastcgi_script_name;
20+
fastcgi_param PATH_INFO $fastcgi_path_info;
21+
}
1922

23+
location ~* \.(jpe?g|gif|png|bmp|ico|css|js|pdf|zip|htm|html|docx?|xlsx?|pptx?|txt|wav|swf|avi|mp\d)$ {
24+
access_log off;
25+
log_not_found off;
26+
try_files $uri $uri/ /$uri /index.php?$args;
27+
expires 1w;
28+
}
29+
}

0 commit comments

Comments
 (0)