Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1320|回复: 0
打印 上一主题 下一主题

nginx配置php

[复制链接]

1228

主题

1996

帖子

7570

积分

认证用户组

Rank: 5Rank: 5

积分
7570
跳转到指定楼层
楼主
发表于 2020-6-5 19:21:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

nginx.conf

  1. user  nginx;
  2. worker_processes  auto;

  3. error_log  /var/log/nginx/error.log warn;
  4. pid        /var/run/nginx.pid;


  5. events {
  6.     worker_connections  1024;
  7. }


  8. http {
  9.     include       /etc/nginx/mime.types;
  10.     default_type  application/octet-stream;

  11.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  12.                       '$status $body_bytes_sent "$http_referer" '
  13.                       '"$http_user_agent" "$http_x_forwarded_for"';

  14.     access_log  /var/log/nginx/access.log  main;

  15.     sendfile        on;
  16.     #tcp_nopush     on;

  17.     keepalive_timeout  65;

  18.     #gzip  on;

  19.     include /etc/nginx/conf.d/*.conf;

  20.     server {
  21.         listen       80;
  22.         server_name  localhost;
  23.         location / {
  24.             root /data/www/file;
  25.             index /promotion/jc_app_downlaod.html;
  26.         }
  27.         error_page   500 502 503 504  /50x.html;
  28.         location = /50x.html {
  29.             root   html;
  30.         }
  31.     }
  32. }
复制代码
conf.d/xx.conf

  1. # admin-api
  2. server {
  3.     listen 8102;
  4.     server_name 192.168.124.48;
  5.     root /data/www/admin-api/public;

  6.     client_max_body_size 18M;
  7.     index index.php;

  8.     location / {
  9.         try_files $uri $uri/ /index.php?$query_string;
  10.     }

  11.     location ~ \.php$ {
  12.         fastcgi_pass   127.0.0.1:9000;
  13.         fastcgi_index  index.php;
  14.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  15.         fastcgi_param  APP_ENV dev;
  16.         include        fastcgi_params;
  17.     }

  18.     location ~/\.ht {
  19.         deny all;
  20.     }
  21. }


  22. # admin web
  23. server {
  24.     listen 8110;
  25.     server_name 192.168.124.48;

  26.     location / {
  27.         root /data/web/admin/dist/;
  28.         index  index.html;
  29.     }

  30.     location ^~/api/ {
  31.         proxy_pass http://127.0.0.1:8102/;
  32.         proxy_read_timeout 300;
  33.         proxy_connect_timeout 300;
  34.         proxy_redirect off;

  35.         proxy_set_header   X-Forwarded-Proto $scheme;
  36.         proxy_set_header   Host              $http_host;
  37.         proxy_set_header   X-Real-IP         $remote_addr;
  38.     }
  39. }

  40. server {
  41.     listen 8080;
  42.     server_name 192.168.124.48;

  43.     location / {
  44.         root /var/www;
  45.         index index.html index.htm;
  46.     }

  47.    # location custom_service {

  48.     #}
  49. }
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-4-20 03:28 , Processed in 0.054798 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表