w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Nginx rewrite rules with try_files
If you need just to rewrite that one css.css file to wp-admin/admin-post.php?action=thesis_do_css then try this: if ($request_filename ~ wp-content/thesis/skins/classic-r/css.css ) { rewrite ^ http://mydomain.com/wp-admin/admin-post.php?action=thesis_do_css? permanent; } That should be within your server{ block. Make sure to change mydomain.com to your actual domain, of course. I hope that helps.

Categories : Htaccess

How to rewrite rules with nginx regular expressions
Ok this is a bit too specific redirect but as far as I understand is you don't need any thing more than this location /local/airports/(.*)-2 { return 301 http://example.com/local/airports/$1; }

Categories : Nginx

Nginx rewrite some matching rules are not working
Actually i don't like neither of the methods, it might be working but it's not really the best way to write it, so lets try something different. location *~ ^/(contact|privacy|terms|faq)/?$ { try_files $uri $uri/ /index.php?v=$1; } location *~ ^/(twitter|facebook|login)/?$ { try_files $uri $uri/ /index.php?v2=$1; } location / { try_files $uri $uri/ /index.php; } o and I never heard of a last; break; it's probably working only because nginx is ignoring the last part of it, it's either a last or a break,

Categories : PHP

How to configure nginx rules so that if one failed it serve the request using another
http://wiki.nginx.org/HttpCoreModule#try_files try_files is your friend, here you can do the order you want to try files and finaly have the proxypass upstream.

Categories : Nginx

Nginx https redirects - stop further rules processing
I usually like to use return instead of rewrite for redirects, try matching the path with a location block location ~ /path/resource(.*) { return 301 $scheme://newdomain.com/newpath/resource$1; } I think this way you know for sure there will be no further processing, because it's only 1 line, try it and tell me how it goes. PS: This will maintain the $scheme of the request, requests to http:// will be redirected to a http:// and https:// will be redirected to https://

Categories : Http

nginx rewrite rules failing - causing 503 errors
This isn't a real answer yet, but a rewrite for your redirect block ( until you provide more info on the error log ) Also please verify that the php sock file is actually located at /tmp/website.co.sock change this server { listen *:80; server_name website.co; rewrite ^(.*) http://www.website.co$1 permanent; } to this server { listen 80; server_name website.co; return 301 $scheme://www.website.co$request_uri; } It's more efficent because it doesn't need a rewrite engine.

Categories : Nginx

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

Any specific rules for converting MySQL data to Prolog rules for exploratory mining?
You could maybe use nth1/1 and the "univ" operator, doing something like this: fieldnames(t, [id,this,that]). get_field(Field, Tuple, Value) :- Tuple =.. [Table|Fields], fieldnames(Table, Names), nth1(Idx, Names, Field), nth1(Idx, Fields, Value). You'd need to create fieldnames/2 records for each table structure, and you'd have to pass the table structure along to this query. It wouldn't be terrifically efficient, but it would work. ?- get_field(this, t(testId, testThis, testThat), Value) Value = testThis You could then build your accessors on top of this pretty easily: findThisById(X, This) :- get_field(this, X, This). Edit: Boris points out rightly that arg/3 will do this with even less work: get_field(Field, Tuple, Value) :- functor(Tuple, Table, _), f

Categories : Mysql

Do I need to convert mod_rewrite rules to Plack::Middleware::Rewrite rules if my web framework wants to support PSGI?
The benefit of PSGI is deployment flexibility. As long as you have rules in mod_rewrite, you are stuck with Apache and, therefore, not getting the full benefit of PSGI. However, as long as you are happy with Apache, I don't see a strong motivation to rewrite all of your rules. If mod_rewrite is giving you headaches, then go for it. Also consider putting your routing logic in your main app code with something like Router::Simple or Path::Router BTW, unless you are really attached to FastCGI, there' probably no reason to use Plack::Handler::FCGI. Keep Apache as your reverse proxy and your app runs in Starlet or one of the other Plack web servers.

Categories : Perl

FxCop custom rules don't have a name in VS2012 (but "official" rules have a name)
This happens because the rule name (as opposed to its class type name) is not contained in the violation message in the FxCop report generated by the Code Analysis run. In theory, Visual Studio could (and probably should) look for the rule name under the <Rules> node in the report before it starts looking elsewhere. However, it doesn't in VS 2012. Instead, it only gets the rule names from rule information acquired from loaded rule assemblies. The tricky thing here is that, for UI display purposes, Visual Studio is doing a completely separate search and load of rule assemblies than is done in the Code Analysis runs. The latter is performed by running fxcopcmd.exe with a command line generated off MSBuild properties. The former uses completely separate logic embedded in the Visua

Categories : Visual Studio 2012

ANTLR error(99) grammar has no rules
The most likely cause is just what the error message suggests. And the most likely reason for that is that you have not saved your grammar to the file--or if you're using ANTLRWorks2--ANTLRWorks hasn't saved your work to the file. I have no idea why ANTLRWorks doesn't save reliably.

Categories : Ant

403 forbidden error at Nginx
You stated: ls -ld /home drwx------ 4 mysite mysite 4096 Jul 20 18:39 mysite If nginx is running as an ordinary user, presumably as something other than "mysite", then it cannot access /home as only the mysite and root users have this permission. To find out what user nginx is running as type: ps faxu .. and search for the nginx process. To get the nginx user just do ps faxu | grep nginx

Categories : Nginx

Unknown error nginx
You can only specify options for the listen directive once per combination of host:port (see the documentation). The error is being caused by this line in your second file: listen [::]:80 ipv6only=on; Because the first file has the ipv6only=on option, the second file does not need it. Changing the beginning of the second file to the following should fix the problem: server { listen 80; listen [::]:80; ... }

Categories : Nginx

PHP Fatal error with nginx
Looking at your example error it appears you are not formatting the require correctly. It should look something like this: require_once(TEMPLATEPATH . '/functions/theme-functions.php'); Make certain that you are also defining your TEMPLATEPATH. define("TEMPLATEPATH ", "/this/is/your/path"); In the end, this should output a string: /this/is/your/path/functions/theme-functions.php

Categories : PHP

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; # 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; } In apache you create a virtual host <Virtua

Categories : Apache

nginx mysterious error despite right configuration
The editor that you used to edit /etc/nginx/sites-enabled/default left a temporary file default~ (note this ~ suffix) in your /etc/nginx/sites-enabled/ directory. You should delete it.

Categories : Nginx

Error in path in GlassFish app when using Nginx
The link on your landing page is generated by the upstream app server. Without changing that, you have to tell nginx how to serve that url. One solution could be adding the following location block: location /Calenicon/ { proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; }

Categories : Java

nginx -> php5-fpm: Error in php not logged (anywhere!)
search for catch_workers_output in your pool and set it to yes, from the doc: catch_workers_output - Redirect workers' stdout and stderr into main error log. If not set, they will be redirected to /dev/null, according to FastCGI specs. Values "yes" or "no" EDIT: also check you have php_flag[display_errors] = on and/or php_admin_flag[log_errors] = true

Categories : PHP

Server Blocks in nginx - 502 Error
The 502 code means 502 Bad Gateway, The server was acting as a gateway or proxy and received an invalid response from the upstream server. It usually means the backend servers are not reachable, which could be a problem with them, not with your front-end configuration. On the machine running Nginx, you should test that you can rest the backend servers. Using w3m or another HTTP client on that machine, check these URLs. Do they load what you expect? http://<my_ip_server_1>:80 http://<my_ip_server_2>:80 If not, you may have some updates to make sure that your Nginx server can reach the backend servers. I should add, you may need send the Host: header to get the backend servers to serve the expected content, if they each host multiple virtual domains. I like to use GET and

Categories : Nginx

Permission error zc.buildout with nginx
Port 443 is below 1024, which means it is a protected port, only open-able by root. So your buildout is correct, you're just running into a 30 old unix restriction :-) Starting nginx on port 8443 or so will probably work fine. An option: run it on an unprivileged port from buildout, but redirect traffic there from some globally installed server.

Categories : Ubuntu

Nginx not running with no error message
Check the daemon option in nginx.conf file. It has to be ON. Or you can simply rip out this line from config file. This option is fully described here http://nginx.org/en/docs/ngx_core_module.html#daemon

Categories : Nginx

Meteor WebSocket handshake error 400 with nginx
if you are receiving this error client side in the browser console, you can safely ignore it - it means that your hosting does not support websockets and meteor will fallback to using long polling instead meteor apps deployed to heroku or any other platform without websockets will get the same error update: as of meteor v0.6.4 you can now set the environment variable DISABLE_WEBSOCKETS to prevent this attempt from occurring if you know it will fail https://github.com/meteor/meteor/blob/devel/History.md If you set the DISABLE_WEBSOCKETS environment variable, browsers will not attempt to connect to your app using Websockets. Use this if you know your server environment does not properly proxy Websockets to reduce connection startup time.

Categories : Node Js

Avoiding Django's 500 error for not allowed host with Nginx
It depends on your default configuration, but from this answer on ServerFault you must define a default vhost in Nginx, otherwise it will use the first one as a default. Basically, your configuration should look like this in order to allow only requests to "mywebsite.com.br" to pass: server { listen 80 default_server; location / { # or show another site return 403 "Forbidden"; } } server { listen 80; server_name mywebsite.com.br; location / { uwsgi_pass unix:/opt/project/run/brmed_web.sock; include uwsgi_params; } } If you need to also serve up other subdomains (www.mywebsite.com.br, etc.) you can set the server_name to ".mywebsite.com.br".

Categories : Django

Mixed content error when proxying websocket through nginx with SSL
Change match original protocol to match origin protocol: io.configure(function() { //io.set('match original protocol', true); io.set('match origin protocol', true); ... }

Categories : Node Js

502 Bad Gateway error Nginx and uWSGI in deploying Flask app
With uwsgi_pass; you declared to Nginx your intent to talk to uWSGI through TCP socket, but have not warned uWSGI about it. Try adding a corresponding socket line to your /etc/default/uwsgi file: PYTHONPATH=/var/www/reframeit-im MODULE=wsgi socket=

Categories : Nginx

Flask + uwsgi + nginx + debug. 502 error instead of debugger page
Flask debug=True does not work when going through uWSGI may help. Essentially, uwsgi is not intended for development environments where you want debugging info in the browser. It's a production server. possibly adding in app.debug = true may help, after you have instantiated the Flask object, but otherwise, to get a proper debugger, use the flask internal server for development.

Categories : Nginx

error on installing passenger nginx module on ubuntu with ruby 2.0.0 via rvm
You have to install development tools first. Most likely you're missing some libraries just like the error is indicating. I ran into the same thing a couple weeks back. Here is a nice tutorial similar to the one that helped me out. http://alexpearce.me/2012/06/setting-up-a-vps/ With a little bit of luck, I believe that this line will solve your current issues, but be sure to look over the whole document. sudo apt-get -y install curl git-core python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev Also: I've also always had troubles when using rvm and have found that rbenv works with less hiccups, which is actually mentioned in this tutorial. For databases, if you aren't using postgres then you should be able to just swap out the

Categories : Ruby On Rails

Nginx, Play and Angular Access-Control-Allow-Origin error
What you need is Nginx to act as proxy, and redirect requests to a specific subpath to Play, while serving the HTML files for the other requests. The documentation of Play has some information on that.

Categories : Angularjs

nginx 403 forbidden error in Rails 4 (with no index.html file)
You'll need to pass the request from Nginx to Unicorn. You can do this like so: server { listen *:80; root /vagrant/public; location / { # Serve static files if they exist, if not pass the request to rails try_files $uri $uri/index.html $uri.html @rails; } location @rails { proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass; } } You may have to change the proxy_pass url. By default, unicorn will listen on but, if you have changed that, then you will need to specify that port.

Categories : Ruby On Rails

boost::spirit::qi Rules with identical simple adapted struct attributes give compile error
This is again a problem with adapting single element sequences. Unfortunately I don't know a workaround for this case. In this situation you can remove the adaptation of B and specialize transform_attribute. There is a simple example here that does almost exactly what you want. #include <boost/fusion/adapted/struct.hpp> #include <boost/spirit/include/qi.hpp> #include <string> namespace qi = boost::spirit::qi; struct A { int index; std::string name; }; BOOST_FUSION_ADAPT_STRUCT(::A, (int, index)(std::string, name)) struct B { A data; }; namespace boost{ namespace spirit{ namespace traits { template <> struct transform_attribute<B,A,qi::domain> { typedef A& type; static type pre(B& val){ return val.data;}

Categories : C++

CSS lower specificity rules override higher specificity rules
Your both rules having different meaning .parent-class p this specify the rule for p which is inside the container having class .parent-class p.child-class this specify the rule for p which has the class child-class JsFiddle Example

Categories : CSS

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; } 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

Macro to run rules
Sub RunAllInboxRules() Dim st As Outlook.Store Dim myRules As Outlook.Rules Dim rl As Outlook.Rule Dim runrule As String Dim rulename As String rulename = "Your Rule Name" Set st = Application.Session.DefaultStore Set myRules = st.GetRules Set cf = Application.ActiveExplorer.CurrentFolder For Each rl In myRules If rl.RuleType = olRuleReceive Then If rl.Name = rulename Then rl.Execute ShowProgress:=True, Folder:=cf runrule = rl.Name End If End If Next ruleList = "Rule was executed correctly:" & vbCrLf & runrule MsgBox ruleList, vbInformation, "Macro: Whatever_Finished" Set rl = Nothing Set st = Nothing Set myRules = Nothing End Sub Try above which runs a single rule, just edit the rulename to one of your existing rules and Whater_Finished to anything you want... no combo box but a

Categories : Vba

How to manage ACL rules?
You can avoid populating the entirety of the ACL list by lazy loading. This is a very simplistic approach but the concept should scale. This assumes that for a given request most if not all of the acl checks will be against single users role, but the same technique could be used for a controller or a combination of role and controller. Define the acl in a tabular way (csv, json, ini, db table, or php include) whatever just so you can get, an array that contains allow or deny, action, and role. I'm going to go with a php include because it assumes the least. You would have one of these for each of the roles. return array( array("allow", "someController", "someAction"), array("deny", "someController", "someOtherAction") ); Add a method onto your AccessControlList to read an

Categories : PHP

Randomize CSS Rules
Mind you this is a bit psuedo-ey, also note that you can do this using pure JS. foreach (var e in document.getElementsByTagName("*")) { foreach (var p in el.style) { var r = Math.random(0, 255); e.style[p] = r; } } also note that not all css properties take 0 - 255 so you might have to create your own algorithm, but this'll sure get you started.

Categories : Javascript

.htaccess to rules ASP .NET
The URL Rewrite Module in IIS 7 and above provides an import feature that greatly simplifies the process of converting Apache mod_rewrite rules to IIS URL rewrite rules. Importing Apache mod_rewrite Rules

Categories : Asp Net

Assignment rules
That's because integers are immutable and lists are mutable. >>> i = 0 >>> t = (i,) >>> t[0] is i # both of them point to the same immutable object True >>> i += 1 # We can't modify an immutable object, changing `i` simply # makes it point to a new object 2. # All other references to the original object(0) are still intact. >>> i 1 >>> t # t still points to the same 0 (0,) >>> x = y = 1 >>> id(x),id(y) (137793280, 137793280) >>> x += 1 >>> id(x),id(y) #y still points to the same object (137793296, 137793280) for lists: >>> l = [0] >>> t = (l,) >>> t[0] is l #both t[0] and l point to the same object [0] True >>> l[0]

Categories : Python

Nullify css rules
What you're witnessing is CSS by design. Specifically, specificity. If your goal is to release some kind of library that can be used publicly and you want to avoid naming conflicts, I think a fair practice is to simply namespace your selectors, e.g., .starkers-color { color: blue; }. That won't necessarily avoid specificity issues, but it should prevent against having your selectors overridden by implementors.

Categories : HTML

EmailAddressAttribute validation rules
Basically, in email address string. You have texts before and after "@" sign. Each character in texts should match 2 rules: [a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF] some unicode code rules as I listed below. The first rule means a char in text can be one of the following: a-z any digit one of !#$%&'*+-/=?^_`{|}~ in unicode range u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF Then texts are separated by . It should be something like: private static Regex _regex = new Regex(@"^ ( ( ([a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])+ (.([a-z]|d|[!#$%&'*+-/=?^_`{|}~]|[u00A0-uD7FFuF900-uFDCFuFDF0-uFFEF])+)* ) | ( (x22) ( (((x20|x09)*(x0dx0a))?(x20|x09)+)? ( ([x01

Categories : C#

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