Quantcast
Channel: Nginx Forum - How to...
Viewing all 4759 articles
Browse latest View live

Adding second server and location - help!

$
0
0
Ive got a working config for my DO droplet to handle the Ubiquiti Unifi Controller installed on the droplet...i figured this config out and ive had this working for ages with no issues

Basically it bumps the subdomain url from http to https and uses the port 8443 where Tomcat is running, and uses letsencrypt

But now i need to run another web server for a basic page on the same server

Ive installed lighttpd and set the port to 88, the html files are under /var/www/html/admin (/var/www/html being the correct root folder for lighttpd)

But no matter what i do adding another service or location tot he existing config leads to nothing being displayed and the usual 404 500 or 502 errors

I could use a fresh pair of eyes, ive been going around in circles for hours :)

Ive read plenty of articles, but none the wiser, im sure its something simple im missing...

Thanks in advance for any suggestions

Current config below:



#/etc/nginx/sites-enabled/default

server_tokens off;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";

server {
listen 80;
server_name default_server;
error_log /var/log/unifi/nginx.log;

location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/html/letsencrypt;
}
}

server {
listen 443 ssl default_server http2;
server_name wifi.domain.com.au;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_certificate /etc/letsencrypt/live/wifi.domain.com.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wifi.domain.com.au/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 300;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
add_header Strict-Transport-Security max-age=31536000;
add_header X-Frame-Options DENY;
error_log /var/log/unifi/nginx.log;
client_max_body_size 8M;
proxy_cache off;
proxy_store off;

location / {
include /etc/nginx/proxy_params;
proxy_pass https://127.0.0.1:8443$request_uri;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

Query on NGINX Open Source

$
0
0
Hi All,

I was referred by my colleague about NGINX. So i am new to CentOS and NGINX.

We planned to have these services (Webserver and load-balancer) using NGINX Open Source.

1. I read installation document. It mentioned i can compile Open Source or install Prebuilt Open Source Package. This is the statement "The package includes almost all official NGINX modules". Question is, does it includes Webserver and load-balancer?

2. What is the hardware requirements? CPU, memory and disk space for Webserver and load-balancer?

3. What are the steps, commands i had to enter?

Look forward to your guide to achieve my objective.

Re: Query on NGINX Open Source

$
0
0
Hi All,

BTW, the load-balancer i mentioned was a "reverse proxy" for my internal SINGLE Exchange server. Hope the Prebuilt NGINX open source package includes it. Show me the guide for this too.

Thanks.

How to enable php windows server 2016

$
0
0
Hello, I have Nginx Crow running on a windows server and I would like to enable php for it.
Is there a guide here on enabling php? There is no php stuff in my nginx.confg.

Trying to setup a Contact Us form on my website but when I submit the info, I get this error;
405 Not Allowed
nginx/1.13.10.1 Crow

I assume because php is not running on my server.


Thank you

Re: How to enable php windows server 2016

$
0
0
Have a look at the Install_nginx_php_services.zip link, after that see this https://www.mkyong.com/nginx/nginx-php-on-windows/

Re: How to enable php windows server 2016

$
0
0
okay, I'll check it out but I can't find the 'Install_nginx_php_services.zip' file

Re: How to enable php windows server 2016

$
0
0
Actually, I think I got it installed correctly, I can get to my test.php file information

how to send mail via gmail smtp

$
0
0
Hello, I am using a php script to send mail via a Contact Form on my webpage but I get an error saying that I have to configure the smtp stuff in php.ini. I found the php.ini-production file and the smtp sectiion but it only has a spot for smtp server, port and sendmail from. Do I not have to put a spot from my password? or since I have my gmail account set to allow sending of emails, it will just go through without needing the password?

Re: how to send mail via gmail smtp

$
0
0
My php script is;
[code]
<?php

$EmailFrom = "test@gmail.com";
$EmailTo = "name@mail.com";
$Subject = "Nice & Simple Contact Form by CSS-Tricks";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));

// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?> [/code]


Can I just add this to the above script instead;
ini_set('SMTP','smtp.gmail.com');
ini_set('smtp_port',25);


instead of editing the php.ini? where do I put my gmail username and password?

Re: how to send mail via gmail smtp

$
0
0
// Configuring SMTP server settings
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = $email;
$mail->Password = $password;

Re: how to send mail via gmail smtp

$
0
0
Okay, thanks. Do I have to download anything else like sendmail or just put this;

// Configuring SMTP server settings
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = $email;
$mail->Password = $password;


above //validation ?

how to setup 2 domains

$
0
0
Hello, I have 2 domain names so how do I set that up? do I just add a second server setting in nginx.conf? want the second one to go to a subfolder in my main webserver folder. thanks

Re: how to setup 2 domains

$
0
0
I tried to set 2 servers like the below but nginx doesn't start when I do :(

server {
listen 80;
server_name server1.com;
root C:/xampp/htdocs;
access_log off;
error_log off;
location / {
#root html;
index index.html index.htm;
}

server {
listen 80;
server_name server2.com;
root C:/xampp/htdocs/Test;
access_log off;
error_log off;
location / {
#root html;
index index.html index.htm;
}

Kibana redirection to nginx "#"

$
0
0
Hello.,

I am trying to find the answer to the nginx proxy pass and rewrite rule. Where :

- with location "/", no issue is seen when opening kibana UI thru Nginx
- As we have a kibana dashboard which requires argument value to be passed in the URL (for example http://host1/fileusagedashboard/1234 will open the kibana dashboard with the value "1234" as parameter value passed.

Question : when the dashboard is opened with redirection, the "#" is converted to "%23" leading to HTTP 404 not found, can any one please share the clue about this and how to avoid, yes, i followed this - https://stackoverflow.com/questions/23873170/nginx-redirect-special-characters-like-23-in-url-to/23877109#23877109

But I am not able to understand. Please help to share hint.

Thanks
HK

Computing total data transfered between clients and server?

$
0
0
Can i computing total data transfered between clients and server by nginx?

Re: how to send mail via gmail smtp

$
0
0
Hello, doesn't seem to be working.
Getting error when I click Submit on my contact page;
This page isn’t working
www.website.com is currently unable to handle this request.
HTTP ERROR 500

Re: how to send mail via gmail smtp

$
0
0
I'm doing this on my Debian server now and I installed Sendmail so now it says Message is sent but I didn't configure it ?? When do I configure Sendmail? Thanks

Re: how to send mail via gmail smtp

$
0
0
Nevermind, it is working. I didn't have to configure anything. What server does Sendmail use by default? Does it just use my own server?

How to create new request in module?

$
0
0
How I can make new request in other module? (to publish events into nchan-channels)

Short Friendly URL

$
0
0
I have configured nginx as a Reverse Proxy
i have www.example.com configured, and need to configure test.example.com to mask www.example.com/dir/test

How can i do this without redirecting?
Viewing all 4759 articles
Browse latest View live