配置nginx作为apache的保留代理 - 安装ossn开源社交网络

时间:2017-02-01 09:46:35

标签: apache ubuntu nginx proxy

这是我在这里的第一篇文章。我总是试图自己解决问题,并在之前提出的问题中找到解决方案。好了,3天了,我正在尝试为ossn(open source social network)设置一个nginx服务器。

所以我跟着this tutorial进行基本设置。 完成本教程的指南后,我看到了相同的info.php 但我无法成功运行我的应用程序的PHP脚本。 CMS正在与之合作 动态网址。切换特定URI部件的案例等...... 因此,访问的域不一定是* .php

我对linux很新。在尝试配置nginx时,我经常会遇到一个糟糕的网关或404.信息php工作正常。一旦我想访问我的cms的根,我得到了一个apache找不到的文件。

如果你可以瞥一眼那就太好了。

Greets Jules

cgi.fix_pathinfo = 0;

已设定。

nginx -t 

告诉我语法正常,Apache2和Nginx的状态是“活动的”。

我的Apache2日志:

 [Wed Feb 01 07:29:29.287223 2017] [ssl:warn] [pid 6941] AH01909: ellingtons-palace.test:443:0 server certificate does NOT include an ID which matches the server name
[Wed Feb 01 10:18:39.179882 2017] [mpm_prefork:notice] [pid 4514] AH00169: caught SIGTERM, shutting down
[Wed Feb 01 10:18:40.142089 2017] [mpm_prefork:notice] [pid 5128] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
[Wed Feb 01 10:18:40.142155 2017] [core:notice] [pid 5128] AH00094: Command line: '/usr/sbin/apache2'

我的Nginx错误日志会生成数百个这样的日志:

2017/02/01 10:18:16 [alert] 4554#4554: socketpair() failed while spawning "worker process" (24:$ Toom many files open)

正如您在我的Nginx配置中看到的那样,我试图增加worker_processes

我的nginx.conf:

user www-data;
worker_processes 1024;

# set open fd limit to 30000
worker_rlimit_nofile 30000;

pid /var/run/nginx.pid;


events {
        worker_connections 2048;
        multi_accept on;
}

http {
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

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

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1.2 TLSv1.1 TLSv1; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers off;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml appli$

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

服务器:

upstream ellingtons-palace.test {
    server ellingtons-palace.test:8000;
}



server {
    listen 127.0.0.1:80 default_server;
    listen [::]:80 default_server;

    large_client_header_buffers 4 32k;
    client_header_buffer_size 32k;
    client_body_buffer_size 10M;

    root /var/www/html/ellingtons-palace.test/;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name *.ellingtons-palace.test www.ellingtons-palace.test;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            proxy_pass http://ellingtons-palace.test/:8000;
            include /etc/nginx/proxy_params;
            autoindex on;
            #try_files $uri $uri/ =404;
    }
    location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ {
            #expires      48h;
    }
    location @proxy {
            proxy_pass http://127.0.0.1:8000;
            include /etc/nginx/proxy_params;
    }
    location ~* \.php$ {
            proxy_pass http://127.0.0.1:8000;
            include /etc/nginx/proxy_params;
    }

}

我的港口用法:

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1893/mysqld         
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      1396/systemd-resolv 
tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN      4554/nginx: master  
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1396/systemd-resolv 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1045/cupsd          
tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN       5128/apache2        
tcp6       0      0 :::5355                 :::*                    LISTEN      1396/systemd-resolv 
tcp6       0      0 :::80                   :::*                    LISTEN      4554/nginx: master  
tcp6       0      0 ::1:631                 :::*                    LISTEN       1045/cupsd          
tcp6       0      0 :::443                  :::*                    LISTEN      5128/apache2 

不幸的是,这一切都导致了无聊的404

root@jwmc-server:/var/log/nginx# curl -I ellingtons-palace.test
HTTP/1.1 404 Not Found
Server: nginx/1.10.1 (Ubuntu)
Date: Wed, 01 Feb 2017 09:33:18 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive

0 个答案:

没有答案