Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Source Social Network using the Nginx webserver #718

Closed
squire-bob opened this issue Jan 3, 2016 · 6 comments
Closed

Open Source Social Network using the Nginx webserver #718

squire-bob opened this issue Jan 3, 2016 · 6 comments

Comments

@squire-bob
Copy link

squire-bob commented Jan 3, 2016

nginx configuration

server {
        listen  80;

    root /var/www/html/ossn;
    index index.php;

    server_name <FQDN>;

    autoindex off;
    location = /rewrite.php {
            rewrite ^(.*)$ /installation/tests/apache_rewrite.php break;
    }
    location /action {
            rewrite ^/action\/([A-Za-z0-9\_\-\/]+)$ /system/handlers/actions.php?action=$1&$query_string break;
    }
    location / {
            if (!-e $request_filename){
                    rewrite ^/([A-Za-z0-9\_\-]+)$ /index.php?h=$1 break;
            }
            if (!-e $request_filename){
                    rewrite ^/([A-Za-z0-9\_\-]+)\/(.*)$ /index.php?h=$1&p=$2 break;
            }
    }
    location /error_log {
            deny all;
    }
    location ~ (nginx|htaccess).dist {
            deny all;
    }

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;

    }

}

Above is a possible nginx server block configuration. The install site comes up but informs me that "Apache is Required" Any help on removing/modifying that portion so I could continue testing would be great.

@squire-bob
Copy link
Author

squire-bob commented Jan 3, 2016

Everything I'm doing is with version 3.9 or I would be uploading things to github.
I've added a bit of code to /installation/classes/OssnInstall.php to pass check for apache

    /**
     * Check if server is running apache or litespeed
     * @last edit: $arsalanshah
     * @Reason: Initial;
     *
     */
    public static function isApache() {
        if (preg_match('/apache/i', $_SERVER["SERVER_SOFTWARE"]) || preg_match('/LiteSpeed/i', $_SERVER["SERVER_SOFTWARE"]) || preg_match('/nginx/i', $_SERVER["SERVER_SOFTWARE"])
        ) {
            return true;
        }
        return false;
    }

I'll close this now, as it's not an issue anymore.

@lianglee lianglee changed the title Using the Nginx webserver Open Source Social Network using the Nginx webserver Feb 11, 2020
@ahrasis
Copy link

ahrasis commented Jan 19, 2021

I think it is best to support all types of web server rather than just apache and litespeed, thus wise this should be PR'ed.

Furthermore, naming the function as isApache() might cause confusion, if the purpose is actually aimed to check web server, so I'd suggest a better name, e.g. isWebServer().

However, this might affect other codes, so, will need to check all of them before renaming.

@lianglee
Copy link
Member

@ahrasis there are many web servers available but we are not really expert in others, and we can learn many other web servers. If you wish to submit your web server configurations please provide the server name, its configurations and other details before we merge in the core.

@ClosetGeek-Git
Copy link

@squire-bob just out of curiosity why are you setting fastcgi_param SCRIPT_FILENAME?

@lianglee
Copy link
Member

lianglee commented Aug 20, 2022 via email

@ClosetGeek-Git
Copy link

You can use https://github.com/opensource-socialnetwork/nginx

I can see trying to support a new server causing multiple headaches down the road, but I think this is a good step. Being opensource, it's likely that the community will help as long as there's at least a nod of approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants