w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why do we need nginx with thin on production setup?
Ngnix is used to load balance thin. You may wish to use Unicorn instead. More on the matter here: http://cmelbye.github.io/2009/10/04/thin-vs-unicorn.html

Categories : Ruby On Rails

How to setup nginx for roundcube in ispconfig server?
SOLVED: same configuration for squirrelmail works :-) location /roundcube { root /usr/share/; index index.php index.html index.htm; location ~ ^/roundcube/(.+.php)$ { try_files $uri =404; root /usr/share/; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $r

Categories : Linux

Securing Passwords in a Multi-Dev nginx setup
Using permissions, you could do something like: 1) give one developer a user 2) chown every folder under /var/www/ to user www-data, and a specific group for that site, something like: /var/www/site-a www-data group-a /var/www/site-b www-data group-b etc. 3) chmod every directory (and all subdirectory and files with -R) to 770 4) add each developer to every group for which he is actually developing.

Categories : PHP

Joomla 3.1 setup on Ubuntu 12.04 running nginx
The permissions when t3 installs are correct, it sounds like the problem is with ownership rather than permissions. I think in ubuntu the system user is www-data so you would need to run the following over ssh chown -hR www-data:www-data /path/to/joomla/root Then upload the plugin through the joomla installer (and change folder permissions back to 755 and files to 644).

Categories : Joomla

502 Bad Gateway in node + nginx proxy setup on Heroku
I am not really familiar with Heroku, and pretty new to Nginx, but I'll give it a shot: To me it looks like the Nginx-config is saying that Nginx and the node.js app are using the same port (<%= ENV['PORT'] %>). What you want is Nginx to listen to incoming connections (usually port 80), and have it forward them to the node.js app. Here is an example Nginx config: # the IP(s) on which your node server is running. I chose port 4000. upstream xxx.xxx.xxx.xxx { #Your IP adress as seen from the internet server 127.0.0.1:4000; #Your local node.js process } # the nginx server instance server { listen 0.0.0.0:80; #Have Nginx listen for all incoming connections on port 80 server_name my-site; access_log /var/log/nginx/my-site.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_s

Categories : Node Js

Find and Replace with Nginx Reverse Proxy setup
It's not ideal, as really the source should be rewritten, but you can use sub_filter to rewrite the content of responses for proxied requests. With your example this would be: location /something { ... sub_filter '(111) 123-4567' '(222) 765-321'; sub_filter_once off; } The default behaviour of this is to replace once (which I have disabled in the example) and to only apply the changes to html pages (this is based on the mime type of the response). This is suitable for using in a reverse proxy as it can replace the Location header with the default options, and links when you disable the sub_filter_once option. While this module is not available unless explicitly configured at compile time, it is my experience that any package manager installed nginx has this option enabled.

Categories : Search

Nginx cannot serve Rails files in Unicorn + Vagrant setup
As you said, here's your setup: Create symlink for nginx conf file for dactarkhoj cd /etc/nginx/sites-enabled sudo ln -s /vagrant/config/nginx.conf dactarkhoj.conf sudo service nginx start I think that you should copy dactarkhoj.conf to /etc/nginx/sites-enabled/default and override it.

Categories : Ruby On Rails

How do I setup my nginx configuration file to allow websocket connections via Tornado?
Apparently you need to force upgrade nginx on Ubuntu: sudo apt-get install python-software-properties sudo apt-get install software-properties-common sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get upgrade nginx service nginx status

Categories : Nginx

Have you managed to make your node nginx proxy setup on Heroku work?
This article contains instructions on setting up nginx as a proxy on Heroku, in conjunction with OpenResty, Lua, and LuaRocks. node.js isn't mentioned. It uses this buildpack. Haven't tried it myself but seems someone has got it working.

Categories : Node Js

Socket.io connection failing when passing through Nginx
There's a special configuration for websockets described on nginx website. You may want to try either of them to see which one works best for you (if works at all). But as noted in Socket.IO wiki, it's best to use HAProxy or Varnish.

Categories : Node Js

Node.js Socket.io WebSocket Nginx Configuration?
Try to use the proxy_set_header: server { listen 80; server_name app.local; root /home/app/public; passenger_enabled on; rails_env development; location /any_location { proxy_pass http://localhost:3001/realtime_page; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } http://blog.joshsoftware.com/2013/05/28/websocket-over-nginx/ What is the server responding (header) ? How does the request header looks like?

Categories : Node Js

How to properly setup nginx as a reverse proxy for gunicorn and flask using subdomains, for both SSL and non-SSL configurations?
server { listen 80 default_server deferred; listen 443 default_server deferred ssl; listen [::]:80 ipv6only=on default_server deferred; listen [::]:443 ipv6only=on default_server deferred ssl; server_name example.com www.example.com testing.example.com; root /path/to/static/files # Include SSL stuff location / { location ~* .(css|gif|ico|jpe?g|js[on]?p?|png|svg|txt|xml)$ { access_log off; add_header Cache-Control "public"; add_header Pragma "public"; expires 365d; log_not_found off; tcp_nodelay off; open_file_cache max

Categories : Python

Socket and ports setup for high-speed audio/video streaming
I think it is better to use an object mechanism and send data in an interleaved fashion. This mechanism may work faster than multiple port mechanism. eg: class Data { DataType, - (Adio/Video) Size, - (Size of the Data buffer) Data Buffer - (Data depends on the type) } 'DataType' and 'Size' always of constant size. At the client side take the 'DataType' and 'Size' and then read the specifed size of corresponding sent data(Adio/Video).

Categories : C#

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

Will select (or epoll) mark a socket as readable if there is data on the socket prior to adding the socket to the list of monitored file descriptor
will select now immediately let me know that the socket is readable? Yes. What, if in step 5, the peer does not send me any data but say, since a FIN. Will select still tell me that the socket is readable Yes. in summary, the question is if select(or any of its variants such as epoll) indicate that a socket is readable if there has been any activity on the socket prior to including the socket in the list of monitored file descriptors and assuming that the application has read no data from the socket Yes.

Categories : Sockets

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

How to add option that User to select a location to install in .Net Setup Project while installing setup?
Case of Winforms deplyment: Right click on the deployment project in the Solution window and select View, File System. Click on the Application Folder. Notice in the Properties window, change the Default location to whatever you want Case of Web: You can implement this by overriding the “Install” method, check this for an example Allow user to set physical directory path during Web Project deployment

Categories : Asp Net

How to setup a HTTP Source for testing Flume setup?
Hopefully this helps you get started. I'm having some problems testing this on my machine and don't have time to fully troubleshoot it right now, but I'll get to that... Assuming you have Flume up and running right now, this should be what your flume.conf file needs to look like to use an HTTP POST source and local file sink (note: this goes to a local file, not HDFS) ########## NEW AGENT ########## # flume-ng agent -f /etc/flume/conf/flume.httptest.conf -n httpagent # # slagent = SysLogAgent ############################### httpagent.sources = http-source httpagent.sinks = local-file-sink httpagent.channels = ch3 # Define / Configure Source (multiport seems to support newer "stuff") ############################### httpagent.sources.http-source.type = org.apache.flume.source.http.HTTP

Categories : Java

How to close setup window after installation by Inno Setup?
You need to add the nowait flag to that [Run] section entry. So modify your script like this: [Run] Filename: {app}myexe.exe; Description: Launch my app; Flags: postinstall skipifsilent nowait

Categories : Windows

Is it possible to setup environment variables within noses setup.cfg
No nose does not have any current ability to set environment variables from a config file: def _configTuples(self, cfg, filename): config = [] if self._config_section in cfg.sections(): for name, value in cfg.items(self._config_section): config.append((name, value, filename)) return config def _readFromFilenames(self, filenames): config = [] for filename in filenames: cfg = ConfigParser.RawConfigParser() try: cfg.read(filename) except ConfigParser.Error, exc: raise ConfigError("Error reading config file %r: %s" % (filename, str(exc))) config.extend(self._configTuples(cfg, filename)) return config Any configuration options specified from a configuration file

Categories : Python

explain behavior of accept function when is called on active socket (instead of passive socket)
Most propably the call to accept() failed. You shall test whether accept() returned -1 prior to looking into cliaddr. Also the code you show close()es the listing socket (down in do_Work()) after the first accept(). Any following accept() though will surely fail.I missed the call to fork() As per Duck's comment: However as long as the call to listen() is commented out accept() has to fail.

Categories : C

Can socket objects be shared with Python's multiprocessing? socket.close() does not seem to be working
The problem is that the socket is not closed in the parent process. Therefore it remains open, and causes the symptom you are observing. Immediately after forking off the child process to handle the connection, you should close the parent process' copy of the socket, like so: while True: print "accepting" c, _ = s.accept() p = Process(target=process, args=(c,)) p.start() print "started process" c.close()

Categories : Python

GCDAsyncSocket connect fails -- only when socket variable is called "socket". What is happening?
As @bburn suggested, this is a symbol collision. There is a BSD socket() function which GCDAsyncSocket uses. If you look at the EXC_BAD_ACCESS in the debugger, you'll see that it's actually failing when attempting to call socket() because it's resolving the function address to that of your variable. Aside from renaming the variable, you can do a couple of things (I think it would be a good idea to do one of these things even if you also rename the variable): Declare the variable to be static. This will confine the scope of your variable to that file so that it cannot be accidentally resolved by GCDAsyncSocket. It would be a good idea to remove it from the global namespace anyway. Make it a private member variable. To change it to a private member variable, change this: @implemen

Categories : Objective C

node.js + socket.io + redis architecture - horizontal serverscaling socket connections?
When you're horizontally scaling, you need to share a datastore between your servers. Conveniently, you already have an ideal one, which is Redis. Instead of keeping your socket mapping in an array, you need to push it into Redis, and do lookups from there. Then, you can either decide to have servers send messages to each other, or, more scalably, send the messages through Redis as well. So, each server would look at it's queue on Redis to see what messages it should send to which sockets. When a server receives a message, it will push it into Redis addressed to the server that should deliver it. If the ordering of messages matters to you, I would recommend looking at https://github.com/learnboost/kue as layer on top of Redis.

Categories : Node Js

How to receive web socket message from server in client side by html5 socket api
Its always good practice before connecting to websockets, to check if the browser your user is using supports them....like so.... //First check for firefox, and set it to regular websocket...since Mozilla API is differently named if (window.MozWebSocket) { window.WebSocket = window.MozWebSocket; } //Then continue with checking var connection = {}; function connect() { if(window.WebSocket != undefined) { if(connection.readyState === undefined || connection.readyState > 1) { connection = new WebSocket('ws://127.0.0.1:80'); } } }

Categories : PHP

Closing socket after subprocess.Popen leaves socket in TIME_WAIT as long as child process is still running
Closing socket after subprocess.Popen leaves socket in TIME_WAIT as long as child process is still running No it doesn't. It leaves it in TIME_WAIT for a fixed amount of time, 2 or 4 minutes. After the close it has nothing to do with the child process at all.

Categories : Python

A java Socket is a TCP socket. Do I send TCP header information to a website?
do I have to strip away the IP and TCP headers when sending the data through a Socket() in java? Or do I leave the TCP header intact? You don't have the TCP header to strip. You just send and receive data. I tried plain socket, but it was not connecting ... So then I tried using a blocking SocketChannel There's no difference for this purpose between Socket and SocketChannel. If you're using either of them you are only concerned with the data payload, not the IP or TCP headers. Also if don't mind answering another question for me. When I get the payload I try to search for "GET" in hex values (0x47,0x45,0x54) to find the HTTP header, but I never find one. Is this right? I check the IP address requested and its asking for google.com. One thing though is that the port is 443 wh

Categories : Android

NodeJS Dynamically Load server instancess for a socket using socket.io
You are exporting a function, and not an object. This means that the correct call should be sv(io) and not sv.init(io). If you want to expose the init function, you have to use module.exports.init = init.

Categories : Javascript

Why do I received UDP socket answer randomly with Asynchronous UDP client socket?
That's how UDP works. UDP is a protocol that provides an unreliable, unordered data delivery between devices connected to an IP network. It is generally considered a "layer 4" protocol in the OSI stack. One popular use of UDP is for transport of time-sensitive information, such as Voice over IP. UDP is specified in RFC 768. http://www.techabulary.com/u/udp/ You either need to use TCP, or be prepared to handle the out-of-order (and possibly completely missing) responses. SCTP is another option for your transmission protocol.

Categories : C#

Socket closed before able to read from ObjectInputStream(BufferedInputStream(Socket.getInputStream))
You can't use a buffered input stream and another kind of stream on the same socket. The buffered stream will steal data from the other one. Make up your kind the ObjectInputStream will do everything you need. Just use that.

Categories : Java

Java Socket server not recieving data from client socket
Your client doesn't close the socket. Your server reads the socket until EOS, which will never arrive as your client doesn't close the socket. NB don't handle client I/O in the accepting thread. Start a separate thread.

Categories : Java

Socket.io : what happen to the client(socket) after a user is disconnected? Can I/Should I remove it?
In the code above, it is setInterval that is causing the additional logging. You will need to store off the id returned from setInterval then clear it using clearInterval on a disconnect event. Something like: io.sockets.on("connection",function(socket){ var intervalId = setInterval(function(){ console.log("Server calling update collection with socket No.",socket.No); },3000); //When connection is close() socket.on("disconnect",function(){ console.log("A user disconnected"); clearInterval(intervalId); }); }) Other than that, no need to do anything else with the socket on the server side. It will get garbage collected at some point.

Categories : Node Js

How to change the folder where socket.io is fetching the socket.io.js JavaScript file?
socketio sever when receives the request '/socket.io/socket.io.js' , it dynamically builds the content ( considering the transports configured to be supported by the server ). The file is neither served from public / node modules.

Categories : Node Js

boost::asio::ip::tcp::socket -> how to query the socket state?
You can try to use ip::tcp::socket::get_option and get error state with level SOL_SOCKET and option name SO_ERROR. I'm surprised that I have not found the ready boost implementation for it. So you can try to meet GettableSocketOption requirements an use ip::tcp::socket::get_option to fetch the socket error state.

Categories : C++

Chat client - Socket and server socket concurrently
ServerSocket blocks and that's it. But if you only want peer-to-peer communication between two connected parties and nothing more then this behavior is not a problem. You just need two programs: server and client. Server block until it gets connection from client and client blocks until it gets connection. If you want to implement Java IO in single thread you should use Java Nio. There are lots of tutorials for that in internet. For example http://tutorials.jenkov.com/java-nio/server-socket-channel.html. Also it seems that you are not very familar with networking and sockets so it might be beneficial to use some layer instead of raw sockets. Maybe you should consider JeroMQ (https://github.com/zeromq/jeromq) for implementing communication between programs.

Categories : Java

How to make client socket wait for server socket
boolean scanning=true; while(scanning) { try { socketChannel.open(hostname, port); scanning=false; } catch(ConnectionException e) { System.out.println("Connect failed, waiting and trying again"); try { Thread.sleep(2000);//2 seconds } catch(InterruptedException ie){ ie.printStackTrace(); } } } This is the code for sonics comment

Categories : Java

PHP socket sends data but Java socket is not receiving
String str = br.readLine(); expect a which is not sent by the PHP program. Add this : socket_write($socket, "Hello " ); // <<<=== ' ' added

Categories : Java

Socket error - with simple socket programming using python
The problem with windows sockets is that they don't actually die when you close them unless you tell them to. Try adding the following code after you initialise the socket and see what happens. l_onoff = 1 l_linger = 0 s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', l_onoff, l_linger)) The documentation for Lingering can be found at MSDN. also change your shutdown to: s.shutdown(socket.SHUT_RDWR) This should close all connections immediately if windows behaves itself. Which will prevent the buffer error caused by too many sockets lingering.

Categories : Python

UNIX SOCKET - direct write into socket's memory possible?
The socket buffer is owned by the kernel, you will never be allowed to write into kernel space. Never, ever. Too much of a security risk. The only way to do zero-copy is to use vmsplice(2), but it is not officially supported for sockets and is not recommended to use for anything other then pipes. If you do decide to use vmsplice, keep in mind that you must then commit your data in chunks of pages sysconf(_SC_PAGESIZE). Also it is a Linux only syscall and not portable.

Categories : C



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