w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

Pagespeed + nginx - not minifying css and javascript
The urls that ngx_pagespeed can generate are bounded by a setting called 'MaxSegmentLength' [1]. There are good reasons for that. This implies that the amount of files that can be combined into a single url is bounded as well. That might be what is causing the 14 css files to be combined into 3 urls, instead of 1. Skipping minification of javascript can be because of these things: - The javascript was diagnosed to be introspective [2]. - The javascript contains parse errors. It might be worth having a look at nginx's error.log, and check the configuration loading messages and the output of ngx_pagespeed on the first request in there, to figure out what is wrong. [1] See "Limiting the maximum generated URL segment length" at https://developers.google.com/speed/pagespeed/module/restrictin

Categories : Misc

Where is my nginx being configured? Changing nginx.conf still brings me to the 'Welcome to nginx' page
when you rewrited the nginx.conf in the folder of source code of nginx and installed it firstly, it will be copied to /usr/local/nginx/conf/nginx.conf (without specially modification of the configure in the folder of source code). But when you do this secondly, the nginx.conf in the folder of source code will be copied to /usr/local/nginx/conf/nginx.conf.defualt,and it usually don't work unless you use nginx -c /usr/local/nginx/conf/nginx.conf.defualt to assign its configure file evertime. There is a line NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" in your script above,which indicates the configure file clearly. To handle this, I suggest rewrite /usr/local/nginx/conf/nginx.conf (not the one in the folder of source code) instead.

Categories : Nginx

nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Skype uses port 80,443 by default, those are EXACTLY the http and https ports. Try shutting down skype and restarting nginx. If you are using the 'desktop version' of Skype you can change this setting by the way of tools>options>advanced>connections > untick use port 80 and 443 as alternatives. If you are using the win8 app, the only option seems to be shutting down skype completely or removing it completely. Someone has to confirm the win8 app though, I use linux.

Categories : PHP

(ubuntu) nginx: [emerg] bind() to 0.0.0.0:80 failed (13: permission denied)
the socket API bind() to a port less than 1024, such as 80 as your title mentioned, need root access. here is "Bind to ports less than 1024 without root access" and another easier way is to run nginx as root.

Categories : Nginx

nginx.conf for url routing
You might want to try something like this, works like a charm for me: location / { try_files $uri $uri/ @rules; } location @rules { rewrite ^/(.*)$ /index.php?param=$1; } This looks for the location at / which is your web root. All of your web accessible files are found in this directory. If a file exists, it'll take you to that file. If not, then it'll throw you into the @rules block. You can use regexp matching to vary your url formatting. But in short, the (.*) matches any string in your url and takes you to your index. I modified what you had written slightly to feed the original input in to index.php as a parameter. If you don't do this, your script won't have any info about how to route the request. For example, then going to /blablabla will mask the url but pull u

Categories : PHP

Nginx and Cakephp .conf file
Have you tried this? http://book.cakephp.org/2.0/en/installation/url-rewriting.html#pretty-urls-on-nginx If not try my config files. cakephp2-rewrite-rules.conf if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; break; } cake2app.conf location / { index index.html index.htm index.php; allow all; include cakephp2-rewrite-rules.conf; } include php-fastcgi.conf; vhosts.conf server { root /foo/bar; listen vhost:80; server_name vhost; include vhost/cake2app.conf; } Include the vhosts.conf in your nginx.conf in the http section. include vhost/vhosts.conf;

Categories : Cakephp

Default nginx conf file
I guess, first vhost would be used. If you use including virtual hosts (/etc/nginx/sites-enabled/*) the hosts would be included in alphabetical order. So, if you have hosts "a", "b" and "c", first of them will be "a".

Categories : Nginx

When do I need to restart nginx
Probably only when you change its configuration, if you are referring to when your django code changes you have to restart the uwsgi server, usually "touch"ing the wsgi.py file is enough to instruct the uwsgi server. Changes in static files don't require the uwsgi restart (because you usually serve them directly with nginx), and if you don't use cached template loaders, but only the default filesystem loader, you don't require the restart when changing a template either. Note that the cached template loader is usually suggested in production.

Categories : Django

What is "above-the-fold content" in Google Pagespeed?
This is because Google recently changed the page speed tool to better reflect an increasingly mobile web. Mobile data networks have different performance characteristics than wired or wifi so you need to do different things to optimize for them. Above-the-fold is simply the first screen's worth--anything you don't need to scroll to see. Obviously, this varies depending on the device and its orientation, so you may need to generalize and maybe find some workable common options, maybe one targeting smartphones, one for tablets, and one for larger desktops. As for what CSS they are talking about, they are really intending all CSS needed to fully style whatever content is displayed ATF. To determine the load time of your ATF content, they are going to take a screen shot of the final version

Categories : Javascript

PageSpeed site optimization trouble
The solution is quite simple. Problem is in apache configuration: AllowOverride directive. AllowOverride None must be changed to: AllowOverride AuthConfig FileInfo or just AllowOverride All Then, if you want to optimize browser cache leverage browser caching and set ExpiresActive on, config your HTTPD.conf to: AllowOverride AuthConfig FileInfo Indexes or just AllowOverride All The question is, will the hosting administrator account change the settings.....

Categories : Wordpress

Google PageSpeed Service - Compressing images with AngularJS
After doing a bit of research, it seems that PageSpeed works similar to the Google search, in that it indexes your page and looks for images to compress. Seeing as Angular needs to load scripts before pages are loaded, the two just won't work together. There is a possible solution found here: http://www.yearofmoo.com/2012/11/angularjs-and-seo.html For me this won't really work, as I have dynamic search pages that I can't really pre-render with PhantomJS. But for others, this might be useful. Please alert me here if this ever changes!

Categories : Performance

How to prevent Pagespeed from caching images from remote server?
Sounds like you need ModPagespeedDisallow [1]. I find it a little worrying though, that mod_pagespeed is trying to optimize cf2.imgobject.com when the html is being served from frendsdom.com. mod_pagespeed doesn't allow optimisation of resources hosted on other domains out of the box for security reasons, so you need to check your configuration for that. Is there a faulty ModPagespeedAllow line in there? [1] https://developers.google.com/speed/pagespeed/module/restricting_urls

Categories : PHP

How do i restart nginx only after the config test was successful on ubuntu?
Actually as far as i know, nginx would show an empty message and it won't actually restart if the config is bad, the only way to screw it up is by doing an nginx stop then start again, it would succeed to stop but fail to start.

Categories : Ubuntu

Restarting nginx: nginx: [alert] Unable to start the Phusion Passenger watchdog because its executable
Passenger takes what you set in the file nginx.conf by passenger_ruby, for example: passenger_root /home/dev/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.5; passenger_ruby /home/dev/.rvm/wrappers/ruby-1.9.3-p448/ruby;

Categories : Ruby

Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others?
server { server_name example.com; location / { # assuming apache is on port 81 for example proxy_pass http://127.0.0.1:81; # to make apache detect the host header proxy_set_header Host $host; } # if you have assets folders, you can let nginx serve them directly, # instead of passing them to apache location /images { # or /css or /js .. etc try_files $uri =404; } } Note: in the case of assets, sometimes some sites serve assets through rewrites, or even handled by the application it self, you can pass it to apache by adding that in the assets location as a fallback like this location /images { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:81; } In apache you create a virtual host <Virtua

Categories : Apache

Added ExpiresByType to .htaccess but PageSpeed Insights still states that I should "Leverage Browser Caching"
All of the listed resources seem to be external. You cannot add/modify headers and/or caching behavior in general for external resources, hence there is nothing you can to about that. Just make sure that all resources under your control (coming from your server(s) and or CDN) properly leverage caching.

Categories : Htaccess

stuck on nginx location directive
The reason is that the location directive matches URI (absolute path of the Request-URI to be more precise), not Host. When you use http://images, your browser sends request like this: GET / HTTP/1.1 Host: images Notice that request URI is /.

Categories : Nginx

nginx location index directive not working
If you explicitly request /index.html, is it served? If not, you might want to add an explicit root /path/to/root; to your server {} block. Also verify that index.html has the correct permissions. This will help with troubleshooting: It will force a 404 if the root index.html is not found. If that happens, at least you can check the logs to see were it was looking: location = / { index index.html; } Also, be sure to do nginx -s reload when changing the config.

Categories : Nginx

nginx redirect only fails with firefox
Found the issue. Because the /blog redirected to HTTP and all other paths redirected to HTTPS, the problem was with the following configuration line: add_header Strict-Transport-Security max-age=500; When I commented out that line, the issue went away.

Categories : Firefox

Django, nginx and uWSGI caching results until uWSGI/MySQL restart
I had the same behavior and found this post https://plus.google.com/u/0/101898908470597791359/posts/AuMJdgEo93k Adding this line on settings.py (only the OPTIONS key) on Django: DATABASES = { 'default': { 'OPTIONS': { "init_command": "SET storage_engine=INNODB, SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED", } } } seems to have resolved the problem.

Categories : Mysql

Config httpd-vhosts.conf to access like http://IP/v-host
Here is a guide to add vhost to xampp For example, say you had another Web site for ClientB. You’d add 127.0.0.1 clientB.local in the hosts file and the C:xamppapacheconfextrahttpd-vhosts.conf would look like this: NameVirtualHost *80 <VirtualHost *> DocumentRoot "C:xampphtdocs" ServerName localhost </VirtualHost> <VirtualHost *> DocumentRoot "C:Documents and SettingsMeMy DocumentsclientAwebsite" ServerName clientA.local <Directory "C:Documents and SettingsMeMy DocumentsclientAwebsite"> Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *> DocumentRoot "C:Documents and SettingsMeMy DocumentsclientBwebsite" ServerName clientB.local <Directory "C:Documents and SettingsMeMy D

Categories : Apache

nginx + passenger + rails: do I need to start the rails server or just start nginx?
Set nginx to forward to my rails server using this https://gist.github.com/jeffrafter/1229497 worker_processes 1; error_log /usr/local/var/log/nginx.error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream dev { server 127.0.0.1:3000; } server { listen 80; # You could put a server_name directive here (or multiple) if # you have not setup wildcard DNS for *.dev domains # See http://jessedearing.com/nodes/9-setting-up-wildcard-subdomains-on-os-x-10-6 # If we choose a root, then we can't switch things around easily # Using /dev/null means that static assets are served through

Categories : Ruby On Rails

nginx and ssl certificate
This is the .cer file, the .key is the key you used to produce this .cer file, try to remember how you got this .cer file, you probably generated a key file on your device, then created a certificate signing request out of it .csr and then uploaded it to get this certificate correct ? you should already have the key file.

Categories : Ssl

Upgrading Nginx 1.1.9 to 1.4.x
This is what test environments or virtual machines are made for. Your question is quite general and hard to answer this way. Try it out in a test setup. If you don't have that option, read the Changelog. From my experience, I haven't encountered backwards compatibility issues with configurations since 1.0 (before that even, but that's when officially configuration syntax should be considered stable). That's not to say there aren't any.

Categories : Ubuntu

Redirecting to SSL using nginx
In order to use regular expressions for matching locations, you need to prefix the expression with either ~ or ~*: if ($server_port = 80) { location ~ (en|fr)/shop { rewrite ^ https://$host$request_uri permanent; } } From the documentation: To use regular expressions, you must use a prefix: "~" for case sensitive matching "~*" for case insensitive matching Since nginx does't allow location blocks to be nested inside of if blocks, try the following configuration: if ($server_port = 80) { rewrite ^/(en|fr)/shop https://$host$request_uri permanent; }

Categories : Nginx

Regex for Nginx
The way you written it means that the / is the one that could appear multiple times, ie /home///////share, to fix it write soemthing like location ~ /home/[^/]+/share { }

Categories : Regex

How to use nginx proxy_pass
Try the nginx HttpRewriteModule you dont need a proxy for these(tho). it follows this format: rewrite regex replacement flag | | | | rewrite ^/ http://www.example.com/image/file.aspx?img=1 permanent; Then: location / { rewrite ^/ http://www.example.com/image/file.aspx?img=1 permanent; }

Categories : Node Js

htaccess to nginx (help)
Please try the following: server { listen 80; server_name www.website.com; return 301 $scheme://website.com; } server { listen 80; server_name website.com; root /path/to/root; location / { try_files $uri @rewrite; } location @rewrite { rewrite ^/([a-z]+)/?([0-9a-zA-Z]*)/?.*$ /index.php?a=$1&q=$2 last; } }

Categories : Apache

Nginx and Unicorn Set up Not sure what I am doing
I've never used knife... It might be worth checking out this this blog post about setting up Capistrano, Nginx, and Unicorn - I've always found Capistrano to be a good deployment app (and there's lots of support for it, especially on SO). On Heroku, you don't deploy as you would with Capistrano or any other deployment utility - you simply push to a branch on your Heroku server. See: https://devcenter.heroku.com/articles/git for how to deploy on Heroku using Git.

Categories : Ruby On Rails

Git on server with nginx
You need a web frontend for git. Have a look at https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools#Web_Interfaces for an overview

Categories : GIT

Nginx add sites
well if you're going to use only 1 IP, then it's 1 server block ( 1 virtual host ) server { server_name [domain name or ip]; index index.html; # or php or whatever location /foo { root /var/www/foo/public_html; try_files $uri $uri/; } location /bar { root /srv/www/bar/public_html; try_files $uri $uri/; } } You haven't mentioned what kind of application this is, so it probably need some changes depending if its a php site or rails or any thing else, this would work for static content only like html and images.

Categories : Nginx

PHP htaccess to nginx
@Harinder: There must be some RewriteCond based on which you're applying this RewiteRule The reason why i am saying this is that, according to your RewriteRule RewriteRule ^(.*)$ /all_drivers.php?id=$1 [QSA] whatever that comes as a request, you are sending it to all_drivers.php. And if this is the desired rule, then all the request, no matter what will be send to this file only. Also it will be nice if you give us the complete .htaccess code segment that you want to be translated. And please check if you have configured php execution block correctly with all the required fastcgi directives as this blank php's output comes in the case if you have not passed SCRIPT_FILENAME fastcgi directive.

Categories : PHP

Eclipse CDT fails to run compiled executable in Windows with error "terminated, exit value: "
The missing libgcc_s_dw2-1.dll is a telltale sign of a different, and possibly wrong (mismatched pieces?) MinGW installation (or of CDT failing at its autodetection tricks). I suggest compiling something simple from the command line and then something less simple with Make to validate the MinGW installation before involving Eclipse CDT.

Categories : C++

Is it possible to deny range of IPs on Nginx
You can block IP ranges using the CIDR notation. Have a look at the article 'Nginx Block And Deny IP Address OR Network Subnets' You can use IP range calculators like this one that do the math for you. For example your range '43.249.64.0-43.249.85.255' can be expressed as: 43.249.64.0/20 43.249.80.0/22 43.249.84.0/23

Categories : Nginx

How can I hide if I was using nginx or apache2
There are 2 ways to do this. You can modify the source of nginx and changing the server signature in the source, recompiling and installing from there. Alternatively you can add a module called headers-more-nginx-module This then allows you to modify the headers without recompiling each time you wish to change the headers. http://wiki.nginx.org/NginxHttpHeadersMoreModule#more_set_headers Both of these do however require recompiling ngnx and reinstalling.

Categories : Nginx

I'm trying to rewrite a sef url into a plain url using nginx
you probably need to add a break at the end of the line rewrite ^/tools/app/(.*)$ /tools/app?action=$1 break;

Categories : PHP

rand not determined on nginx/php-fpm
You could try mt_srand() and mt_rand() instead. The rand() and srand() functions that you're using now make use of the random functions built into the host operating system. This means that when you move from one platform to another, you're potentially using an entirely different number generator. By contrast, the mt_rand() function uses a Mersenne Twister algorithm built into PHP itself to generate its random numbers. In theory this means that the sequence should be more predictable going from one platform to another. You may still find that the sequence changes if you move from a 32-bit to a 64-bit PHP build, but other than that I'd expect it to give the same sequence in all cases, given the same seed. Hope that helps.

Categories : PHP

Nginx rewrite in subfolder
Try this, I changed my answer to try to imitate the same behaviour you are using in your rewrite. location ~ /blog(.*) { index index.php; try_files $uri /blog/index.php?$1&$args; }

Categories : Wordpress

Nginx SSL on single subdomain instead of many
Without Server Name Indication, a server serving HTTPS content doesn't know what the domain name being requested is (as the Host header is itself encrypted). Thus, all requests to that IP, regardless of domain name, get the default SSL virtual host.

Categories : Ssl



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.