w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Host main domain on Apache and some of the sub-domains on Nginx
A good solution is to continue to run Nginx on port 80, while adding proxy directives to Nginx to serve as a proxy for specific domains that are running on Apache. An example Nginx configuration: server { server_name www.myserver.com; server_name myserver.com; location / { proxy_pass http://127.0.0.1:8000; } } I do this myself, and it works great.

Categories : Apache

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

how to find out how much of file size served by nginx?
With Nginx you can log the amount of bandwidth used pushed to a log file by using the log_module but this is not exactly what you want, but can help achieve what you wish. So, now you will have logs that you can parse to get the file sizes and total bandwidth used and then have a script that updates a database and then you can then authorize future downloads if their limit is reached or within some soft limit range. Server Fault with similar question Another option is, making an assumption, keep the file sizes in a database and just keep a tally at the request so when ever they hit a download link it immediately increments their download count and if it is over their limit then just invalidate the link else make the link valid and pass them over to Nginx. Another option would be to wri

Categories : Python

How to limit max file size for upload in nginx for special location with fastcgi
Is the URI really and exactly http(s)://example.com/account/personal_info/documents/ in your browser? If so, be more specific in your configuration to make sure nginx applies the correct location block. location = /account/personal_info/documents/ { # ... }

Categories : Nginx

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

I cannot bring my id's from my main.xml file to my main.java file
Remove import android.R; from Main.java. Somehow the wrong R got imported. If it cannot resolve R after that, make sure the version that is imported is: import com.example.lolo.R;

Categories : Java

nginx + fpm wanring about buffer size
You might be able to try increasing the buffer size with Nginx. The manual has mentioned this here http://wiki.nginx.org/HttpLogModule access_log /spool/logs/nginx-access.log gzip buffer=32k;

Categories : Nginx

Increase upload size on Nginx
client_max_body_size does not limit the size of an upload. The upload must be set by the server administrator in the .ini file or you may be able to modify the value within a .htaccess file; read this.

Categories : PHP

recommended pool size to set for mongo from a rails app (nginx, mongomapper)?
With a web application server like Passenger, the max pool size for your MongoDB connection will be per passenger worker process since the web server is forking your entire application for each worker. Additionally, if your app (your code) isn't spawning any threads and attempting to do work in parallel, then you can just leave your pool size at 1 since increasing it won't actually help you much in that situation. If you are spawning threads to talk to the database then just make sure your pool size * number of passenger workers doesn't exceed the total number of connections to the database that you want (eg. pool size = 5 * passenger workers = 10 = 50 connections to MongoDB). You probably want your thread pool size and connection pool size to be fairly close to each other. Also, bare

Categories : Ruby On Rails

Linkedin share doesn't show any info. Just the main URL of our website
Are you using better_wp_security on your website? I had the same problem, and in the .htaccess file, there was a line that was blocking the content from showing in LinkedIn. For me, at the bottom of the #Abuse Agent Blocking section in the .htaccess file, there is the following line: RewriteRule ^.* - [F,L] I removed that particular one, and my blog post content shows up correctly in LinkedIn. Definitely want to make a backup of .htaccess if you're modifying it.

Categories : Wordpress

Two instances of same class running via main - what is their associated unique identifier of each thread of main?
Your current approach of generating a unique id yourself is the best idea. The Java and JVM specifications do not define a natural unique identifier. This means that any inherently pre-existing id will be specific to either the operating system or the JVM implementation. This will tie your code to a specific platform and make it less portable. Whether or not UUID.randomUUID() is the best way to generate an id yourself depends on your usecase. One alternative would be to use a shared temp file with a counter to keep track of all the currently running processes.

Categories : Java

java.lang.NoClassDefFoundError Main (Wrong Name : com/leslie/quiz/Main)
Since your Main class is in the com.leslie.quiz package, you should cd to the parent directory of the compiled output and run the command: java com.leslie.quiz.Main Note that the default binary output directory in Eclipse is a project's bin directory. Although it's hidden from the Package Explorer view in Eclipse, it will still exist on the file system. You should be able to see it from the Navigator view in Eclipse. The contents of bin will look something like this: bin/ com/ leslie/ quiz/ Core.class Main.class Start.class In this case, cd to bin and run the java command.

Categories : Java

How can i resolve the Exception in thread "main" java.lang.NoSuchMethodError: main
Your main method is not static, and you should make it static. Check this to see why public static void main(String [] args)

Categories : Java

How to manage resources in a console app that creates main window in main()?
Thanks to slugster's posting Access ResourceDictionary items programmatically I was able to load the resources programmatically in my app's loaded event. Example: ResourceDictionary dict = new ResourceDictionary(); dict.Source = new Uri("../Resources/PageDictionary.xaml", UriKind.Relative); Application.Current.Resources.MergedDictionaries.Add(dict); I'm not sure if this is the best solution but it does what I wanted.

Categories : C#

Scroll 2 DIV contents + main content with browser's main scrollbar
If I got your question right you are looking for the CSS attribute fixed. Here is some HTML including CSS that might do exactly what your are after: <html> <head> <style> body { margin-top: 150px; } .header { width: 100%; position: fixed; top: 0; background-color: white; border-bottom: 2px solid lightblue } .footer { width: 100%; position: fixed; bottom: 0; background-color: white; border-top: 2px solid lightblue } .book table td { vertical-align: top; } .page1, .page2 { border: solid 1px red; width: 400px; } </style> </head> <body> <div class="header">

Categories : Javascript

Is it possible to check that main thread is idle / to drain a main run loop?
you can try this while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true) == kCFRunLoopRunHandledSource); this will run until no more things in the run loop. you can try to change the time interval to 0.1 if 0 is not working.

Categories : IOS

Additional maven source folders such as src/main/javascript or src/main/css?
Add resource folders this way. <project> ... <build> ... <resources> <resource> <directory>resource1</directory> </resource> <resource> <directory>resource2</directory> </resource> <resource> <directory>resource3</directory> </resource> </resources> ... </build> ... </project> More information However, if you want multiple web resources (WEB-INF directory in WAR file) than you need to configure Maven War plugin. <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</ve

Categories : Java

Main cannot be resolved or is not a field, R.layout.main (Tried other methods)
I'm assuming that the layout file you posted is main.xml. (If it isn't, then that's your problem. The name of each layout file is used to name the fields of R.layout.) If I'm correct and that is your entire main.xml file, then it has an error: you don't have a closing tag for <RelativeLayout ...>. If you have an error in any of your XML files, then the resource compiler will not generate an R.java file and you will have unresolved field errors. As an aside, you don't need to import your R class in code that is in your application package (as declared in the manifest).

Categories : Android

What is the relation between the main() method and main thread in Java?
Is there any relation between main() method and Main Thread ? When the JVM starts, it creates a thread called "Main". Your program will run on this thread, unless you create additional threads yourself. The first thing the "Main" thread does is to look for your static void main(String[] argv) method and invoke it. That is the entry-point to your program. If you want things to happen "at the same time", you can create multiple threads, and give each something to execute. They will then continue to do these things concurrently. The JVM also creates some internal threads for background work such as garbage collection.

Categories : Java

Block apc.php file in nginx
Since "deny" not allowed in if statement, you can use nested location like location / { location /uri/ {} }, however, it is not encouraged in Nginx manual: "While nested locations are allowed by the configuration file parser, their use is discouraged and may produce unexpected results."

Categories : PHP

How do I allow a PUT file request on Nginx server?
To add HTTP and WebDAV methods like PUT, DELETE, MKCOL, COPY and MOVE you need to compile nginx with HttpDavModule (./configure --with-http_dav_module). Check nginx -V first, maybe you already have the HttpDavModule (I installed nginx from the Debian repository and I already have the module). Then change your nginx-config like that: location / { root /var/www; dav_methods PUT; } You can get more info on the nginx docs entry for the HttpDavModule.

Categories : Http

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

Don't Allow File Download Without htpasswd nginx
I think cause you only secured the folder, but not the files, try removing the dollar sign to make it match all what's below the folder location ~ ^/(?P<mydir>.*)/$ {} to location ~ ^/(?P<mydir>.*)/ {}

Categories : Nginx

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

Can not fetch the complete file from nginx with http.Get in GO
In this function you aren't closing the os.File. I suspect that is why it is going wrong. func (wtr *vFile) Write(buf []byte) { var f *os.File if wtr.cur == 0 { f,wtr.err = os.Create(wtr.path) } else { f,wtr.err = os.OpenFile(wtr.path,os.O_RDWR|os.O_APPEND,0666) } _, err := f.WriteAt(buf,twr.path) } If not post a complete compiling gofmt-ed example!

Categories : Http

How to configure Phalcon in the Nginx config file
This is the link to the official phalcon nginx configurations. http://docs.phalconphp.com/en/latest/reference/nginx.html

Categories : PHP

Nginx + php5-fpm + Drupal: 404 "File not found"
Please check your root path on the vhost file and the file permission of the folder The file not found error normally appears if the the file is not present or it is not accessible by the browser.

Categories : PHP

nginx, exclude single file from location
You're going to kick yourself when you see the answer. What I want to do here is to exclude one single file called piwik.php as it should receive special treatment in a separate location. Ok, you should set that path as a separate location before your default one. e.g. location ~ ^/stats/piwik.php$ { allow 127.0.0.1; deny all; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_read_timeout 150; fastcgi_index index.php; include fastcgi_params; } location ~ .php$ { fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_read_timeout 150; fastcgi_index index.php; include fastcgi_params; } As those are both regular expression location blocks, the one listed

Categories : Nginx

Stretching UserControl content to main window size WPF
I believe the default behaviour will be for the WebBrowser to fill the UserControl; depending on how you then use your UserControl, it should expand to fill your window, if required. Adding the Source property to the WebBrowser will give you a better idea of the space it's currently occupying. This control: <UserControl x:Class="WpfApplication1.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" Background="Aqua" Margin="0"> <Grid Name="parentGrid"> <WebBrowser Name="browser" Source="http://stackoverflow.c

Categories : C#

Hyperlink doesn't work in IE10 and Chrome 28(Load Main.aspx.cs everytime a link is clicked in Main.aspx)
Try adding a IsPostBack to your Page_load method, like this: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { yourinitcodegoeshere; } }

Categories : C#

When to invoke main rather than call main?
I don't know why you're doing this ever. I've never needed to invoke another main method in this way except when I was doing something hacky or experimenting. But generally you use reflection to call a method instead of calling it directly when you don't know enough about the class you're invoking, or for when you're searching and invoking methods marked with annotation. That's what reflection was meant for.

Categories : Java

How do i go from one function (main) to another without finishing main?(in C)
Just call the function you want to go to. For example: void functionToCall(int x, int y, int z); int main() { //some code... functionToCall(x, y, z); //more code... } void functionToCall(int x, int y, int z) { //more code... }

Categories : C

** glibc detected *** ./main: free(): invalid next size (fast):
You cannot mix C malloc and C++ delete/delete[]. Memory allocated with malloc must be released with free. Memory allocated with new must be released with delete. Memory allocated with new[] must be released with delete[]. Anything else is undefined behaviour. Now, after you edited the program and made sure that all allocation is done by new[] and deletion by delete[] then the reason for errors is a buffer overflow somewhere.

Categories : C++

how to use a scanner's input( used in a swtich case in main's body) in a method('s body) defined outside the main
You can't access the value inside main from another method. All you can do is call the method from main by passing the value as parameter. The work flow is like the execution starts and ends within the main. You can pass the control to any other methods by calling them. This is the way of doing it.

Categories : Java

Nginx + emacs - clearing file results in php errors not logging?
In your FPM Pool Configuration file you can add specific values instead of editing the php.ini file. Here is what I have in my development: php_flag[display_errors] = on php_admin_value[error_log] = /vhosts/example.com/logs/php_error_log php_admin_flag[log_errors] = on You would normally add these to the end of the file. You may already see a few examples pre-packaged there too. Don't forget to restart FPM after making the changes of course.

Categories : Emacs

Nginx - configure location regex for all static file in sub alias
try to add rewrite directive in sub location. Just like this: location /site1 { location ~* .(jpg|jpeg|gif|png|css|js|ico|xml|rss|txt)$ { rewrite "^/site1/(.*)$" /$1 break; root /path/to/anothersite1; } proxy_pass apache:8080; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; }

Categories : File

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 http://127.0.0.1:8080; } } You may have to change the proxy_pass url. By default, unicorn will listen on 127.0.0.1:8080 but, if you have changed that, then you will need to specify that port.

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

I want to put my computational stuff in secondary thread while keeping main loop in main thread
You cannot call OpenGL functions from multiple threads generally speaking (without using multiple render contexts, or context switching). You have to have a bound render context to issue OpenGL commands, and window systems will restrict you to a single context-per thread. To get around this, you are going to need to use a framework that is more advanced than GLUT. The basic idea is that you need to share resources between contexts, one for uploading data into and one for actually rendering. But the more I think about this, there is no real reason for you to do any of this. Stick to using a single thread for all GL commands, maybe load image files from disk in another thread. And signal the thread that you do your rendering in to send the data to GL using glTexImage2D (...). Your use-case

Categories : C++



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