I am trying to get my NGINX website to work with Microsoft clickonce. I have the web site able to display the standard microsoft clickonce install page, but when I get to the Install page on my website and click the install button, nothing happens. I believe at that point it is supposed to download an EXE, which it doesn't do. Does anyone have any experience in getting clickonce to work with NGINX and what is required? Any information about setting correct directives, location, configuration, mime types or whatever else may be required.
Here is my current config file. I am new to NGINX, so perhaps it is something I am doing wrong with the location, or...?
server {
listen 80;
root /usr/share/nginx/www/MyWebSite;
index index.php index.html index.htm;
server_name MyWebSite.com www.MyWebSite.com;
client_max_body_size 100M;
access_log /var/log/nginx/MyWebSite.access.log;
error_log /var/log/nginx/MyWebSite.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /Application/MyApp/ {
try_files /Application/MyApp/publish.htm /Application/MyApp/setup.exe /application/MyApp/MyApp.application;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
types {
application/x-ms-application .application;
}
}
Related
I want to add a domain manually with cli of centos 7 and created a config file in sites-available directory:
server {
listen 80;
server_name hustana.ir www.hustana.ir;
location / {
root /home/www/public_html;
index index.html index.htm;
try_files $uri $uri/ =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
In my server there is another domains that are online and works fine.
if its help I should tell that at start my server was worked by Plesk Obtisian control panel
but now I wanna add another domain to server just but it`s not working.
I changed my domain NS from domain control center.
additional description:
I guess it`s good to say that if I delete the config block of one of my older domains , domain still stay online but it displays just a blank white page.
I tried add to include this config file from another directory directly into nginx.conf:
server {
listen 80;
server_name hustana.ir;
root /home/www/public_html;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
You need to enable your site as mentioned here.
Check the A-record of your domain. It must point to your server IP.
I have a server with multiple sites running on nginx. I'm trying to add another one, and somehow I keep getting redirected to the wrong path.
What I usually do is copy from a working one and change the domain and paths, then create de symlink. I've also checked that they both have the same permissions, so I'm not seeing any mistake on my part. all paths work and of course I've restarted nginx. I also restarted the whole server out of desperation.
The failing one
server {
listen 80;
root /data/alvarezarango.com/www;
index index.php index.html index.htm;
server_name alvarezarango.com www.alvarezarango.com;
error_log /data/alvarezarango.com/logs/error.log error;
access_log /data/alvarezarango.com/logs/access.log;
location ~ [^/].php(/|$) {
fastcgi_split_path_info ^(.+?.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
the working one:
server {
listen 80;
root /data/spiraxtime.com/www;
index index.php index.html index.htm;
server_name spiraxtime.com www.spiraxtime.com;
error_log /data/spiraxtime.com/logs/error.log error;
access_log /data/spiraxtime.com/logs/access.log;
location ~ [^/].php(/|$) {
fastcgi_split_path_info ^(.+?.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
I get redirected to my main domain, but i can't see why. Is anything I can check to understand the redirects?
I am developing a website, and I just installed ssl on the production website (I have never done this before). When I load the development website the page redirects to https and breaks because https isn't installed on the development site.
Development url: http://local.ezel.io
Production url: https://ezel.io
The Nginx (production):
server{
listen 80;
server_name ezel.io;
root /var/www/ezel.io/public;
location ~ /.well-known {
allow all;
}
rewrite ^ https://$server_name$request_uri? permanent;
}
The Nginx (development):
server {
listen 80;
server_name local.ezel.io;
root /home/ryan/Documents/www/ezel.io/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
On my development machine, I also have the following in my hosts file:
127.0.0.1 local.ezel.io
What would be causing me to go from http://local.ezel.io to https://local.ezel.io?
I think the problem is that you enabled https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security once and now your browser insists on trying HTTPS.
Try this: http://classically.me/blogs/how-clear-hsts-settings-major-browsers
Also, try pinging local.ezel.io to ensure it's really your localhost and not actually ezel.io.
I've got this really simple server block under sites-available.
Problem: When I try to access to mydomain.com, Nginx returns a « 404 Not Found », but if I try to access to a file in particular, it works fine, like mydomain.com/index.php
server {
listen 80;
index index.php;
server_name mydomain.com;
root /home/myusername/sites/mydomain.com/htdocs;
access_log /home/myusername/sites/mydomain.com/logs/access.log;
error_log /home/myusername/sites/mydomain.com/logs/error.log;
location / {
try_files $uri =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Note that:
my hosts file is configured ;
I restart Nginx after each edit ;
the access rights, user and group are correct ;
the error.log file is empty, the access.log returns me all the 404 ;
I tried to change the config by adding/removing some lines, still no changes ;
the site is enabled in sites-enabled with a correct symlink (I tried to edit it and it opened the right file) ;
I've got a few sites on the same server who runs well (so the including of sites-available and sites-enabled is OK, and Nginx works fine).
So, the answer was giver to me on ServerFault by Alexey Ten, here is a copy of the answer
Your try_files directive is too restrictive and, I guess, is in wrong place.
Either remove location / completely, it doesn't makes much sense, or, at least add $uri/ so index directive will work.
try_files $uri $uri/ =404;
But my guess is, you need to move this try_files into location ~ \.php$, this will make sure that php-file exsists before pass it to PHP-FPM for processing. All other files will be served by nginx with proper use of index directive.
server {
listen 80;
index index.php;
server_name mydomain.com;
root /home/myusername/sites/mydomain.com/htdocs;
access_log /home/myusername/sites/mydomain.com/logs/access.log;
error_log /home/myusername/sites/mydomain.com/logs/error.log;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
I just installed laravel 4.1 using the recommended install option.
composer create-project laravel/laravel your-project-name --prefer-dist
All went fine, as I was able to see the default page inside /public/ then I removed the .htaccess file since I am using nginx and added try_files $uri $uri/ /index.php?$query_string; for nginx inside the location ~ \.php$ { ... } then I created a simple route
Route::get('/about', function()
{
return "about page";
});
but I am getting the common 404 Not Found nginx/1.0.15 from nginx. I have given 777 permission even to the entire laravel folder. What could be the problem?
You need to point your nginx to the public folder. Here's one of my site config files in nginx:
server {
listen 80 default;
server_name _;
root /var/www/laravel/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
This way, you can browse to your laravel project by requesting: http://localhost/
Watch out: maybe you php cgi is different: use the fastcgi_pass rule you already had.
And readding the .htaccess file doesn't do any harm.
Hope this works for you.